Ireland is planning a system of electronic border surveillance that it hopes will prevent it having to erect physical barriers with Northern Ireland when Britain leaves the European Union, its customs service said on Thursday.

The unexpected result of the June 23 referendum in which U.K. citizens voted to leave the EU created a delicate problem for Ireland, which will remain in the free trade, free movement bloc and has the only land border with the United Kingdom.

The governments of Britain and Ireland, countries with a close but troubled history, have both said they do not want to put border posts back on roads into Northern Ireland, a partly self-governing U.K. province.