By Conor Humphries

DUBLIN (Reuters) - 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 UK 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 UK province.

While Britain is keen to secure some kind of free-trade deal with the EU, exactly how that would work, and what would be the new rules for people moving in and out of the country, Ireland is preparing for at least some changes.

"Even if there is a free-trade agreement, we will still need to know what is being traded, what is crossing the border," Irish Customs Deputy Director General Anthony Buckley told a conference in Dublin.

Customs staff are evaluating technologies such as traffic surveillance and computerized pre-authorization of importers and exporters.

"In autumn, we begin serious work ... we reckon it will take us two or three years to build," Buckley said.

So-called "soft-border" infrastructure is already used in Norway, Sweden and Switzerland, and Ireland is looking at similar technologies, he said.

"A truck should be able to drive from Cork to Belfast without stopping," Buckley said, adding he was confident permanent border posts would not be required for customs purposes.

Britain's ambassador to Ireland, Dominick Chilcott, said he was hopeful there would be no need to limit the free movement of people between Britain and Ireland, neither of which are part of the European Union's Schengen passport-free travel area.

But, he told the conference, avoiding some controls on the trade of goods would be "more difficult".

(Editing by Robin Pomeroy)