Overlooking the River Liffey on Dublin's docks is the neo-classical Customs House, writes David Murphy.

The stunning building took ten years to construct and was completed in 1791 at a cost of £200,000, which was a fortune at the time.

One of its purposes was to collect tariffs on goods coming into Dublin Port.

At the time tariffs were seen as a positive mechanism for any country because they protected a nation's domestic industry from foreign competitors.

Since then economic thinking has been turned on its head.

Protectionism or placing tariffs on goods is seen as a brake on trade.

A good example came in Ireland's economic war with Britain in the 1930s when Ireland imposed tariffs on a wide range of goods from the UK.

The policy of protectionism was seen as economically detrimental to Ireland because it stifled trade and was entirely dismantled in the 1950s by then taoiseach Seán Lemass.

Scrapping tariffs helped put Ireland on the path to economic prosperity.

In 1973 there was a fundamental change when Ireland joined the then EEC. That also brought the country into a free trade area and then the single market, which has been a corner stone of the Irish economy ever since.

Click here for interactive CSO maps

For an export orientated economy free trade with Britain has been enormously beneficial. According to the Central Statistics Office, the UK is Ireland's biggest trading partner in the EU for the export of goods.

But Britain is absolutely vital for Irish agricultural produce because 52% of Irish beef goes to the UK, 60% of cheese exports and 84% of poultry.

Now there is the possibility of tariffs being re-imposed on goods going to and from the UK as Britain goes to the polls on 23 June to decide whether it wishes to remain in the EU.

Polls indicate a tight outcome. If there is a vote to leave the EU we don't know what that would mean. But there are some certainties for Ireland if Britain does vote to leave.

If Britain votes to leave:

Sterling

Sterling is likely to slide against the euro. This will make our exports to the UK less competitive but will make our imports from Britain cheaper.

Uncertainty

There will be two years of negotiations between the EU and the UK regarding its future relationship with Brussels. That period will be dogged by meetings in Brussels and rows over the shape of an exit agreement.

In Ireland, there will be particular uncertainty about the status of the border delineating the six counties.

Unfortunately, Ireland cannot negotiate its own bilateral trade agreement with the UK – that competency has been handed over to Brussels.

So Ireland will be like any other member state and our relationship with Britain will fall into an EU-UK trade agreement.

Confusion over contracts

For Irish businesses Brexit is a headache. If firms are signing two- or three-year contracts there may be hesitancy on both sides until it is clear if Britain will remain in the Single Market.

If Britain votes to stay:

Is that it?

If Britain votes to remain by a narrow margin it would seem unlikely to quell demands of the eurosceptics.

The momentum for closer ties within the EU may become more open to question.

Irish lobby group Hibernia Forum has produced an insightful analysis probing the momentum towards a closer union.

It points out eurosceptic parties are closer to power than ever before across Europe and it highlights the mixed success of the euro.

It also highlights the failings of the EU, including the fact that European officials pay less tax than ordinary citizens.

Sterling

Many expect sterling could rebound if Britain votes to remain in the EU (but predicting the trajectory of any currency is a mug's game so I won't try).

But uncertainty will be lifted and many Irish businesses will breathe a sigh of relief.

Immigration

The key reason for much of the hostility towards the EU in Britain is discontent with lack of control over immigration.

However, many of those who want the UK to remain in the EU point out that Europe is being blamed for many of Britain's ills.

Even if the UK votes to remain, demands for reform of immigration policy will remain on the British agenda.

The referendum on Brexit is a watershed for Ireland.

Regardless of Britain's internal debate about the merits or otherwise of it remaining in the EU, a UK exit would appear to be bad for Ireland based on the analysis of the ESRI.

While tariffs left this country with the Customs House, that is where the benefits of imposing levies on goods to and from the UK ended.

By RTÉ's Business Editor David Murphy