The Irish prime minister, Leo Varadkar, has said the UK and Ireland would have to negotiate a bilateral agreement on “full alignment” of customs to avoid a hard border with Northern Ireland in a no-deal scenario.

It is the first time the taoiseach has mentioned the possibility of a separate deal with the UK to mitigate against a hard border.

He was speaking after the European commission spokesman said it was “pretty obvious” border infrastructure would be necessary if the UK were to leave without an agreement.

Ireland has avoided talking about what it would do in the event of the UK crashing out of the EU, but experts say controls would be mandatory under European and WTO rules on both sides of the Northern Ireland border if the UK left the bloc.

On Tuesday, Varadkar said a no-deal Brexit would present a “real dilemma” for Ireland. “Both the UK and Ireland will have an obligation to honour the Good Friday agreement, protect the peace process and honour our commitment to the people of Ireland and Northern Ireland, that there won’t be a hard border,” he said. “We’d have to negotiate an agreement on customs and regulations that meant full alignment, so there will be no hard border.”

Varadkar’s remarks come just days after Downing Street dismissed reports that it would seek a bilateral agreement with Ireland to break the Brexit impasse. However, the idea that Northern Ireland would remain aligned to the Republic in the event of no deal is unlikely to win support of Brexiters or the Democratic Unionist party.

The Irish government has admitted it would be “very difficult” to avoid border infrastructure in Ireland under a no-deal Brexit, but has refused to countenance any changes to the “backstop” arrangement in the current withdrawal agreement.

Ireland’s foreign affairs minister, Simon Coveney, said his focus remained on the withdrawal agreement and the backstop insurance policy. “In the absence of the backstop and a withdrawal agreement, we have a very difficult job to do to prevent border infrastructure, but of course that would have to be our focus,” he said.

The Irish government has insisted for months that, while it will prepare for a hard Brexit with the UK at the ports and airports, it will not put in place infrastructure to check goods or people at the land border with Northern Ireland.

The backstop in the draft withdrawal agreement has been a central part of Dublin’s plan to avoid checks on the Irish border. “We already have that agreement, that is the backstop. Nobody who is opposed to the backstop can credibly say that they are also against a hard border,” Coveney said. “Unless they can come up with something else. Nobody else has done that yet.”

Poland’s foreign minister has suggested a time-limited backstop but this has been dismissed by other EU ministers who said the “breakthrough” must come from the UK.

The Irish believe a time limit would mean it was not actually a backstop, designed to prevent a hard border if no better trade deal is hammered out between the UK and the EU.