Martin McGuinness has said he cannot see how the Common Travel Area between Northern Ireland and the Republic of Ireland could survive in Brexit talks.
The arrangement allows the free movement of people between Northern Ireland and the Republic of Ireland.
But the deputy first minister said that is now at risk, adding that he viewed that prospect "with great alarm".
First Minister Arlene Foster said there was a need to be "innovative" on how to "police" the Irish border.
They were speaking ahead of a specially convened meeting of the British-Irish Council (BIC) to discuss the implications of the UK's decision to leave the EU.
The summit in Wales is looking at how Brexit could affect trade and the economy.
Sinn Féin's Mr McGuinness said the border will be discussed by the ministers.
"I was alarmed when I heard Theresa May before she became prime minister effectively say that she believed there would be a hard border between north and south," he said.
"I don't see how the Common Travel Area could survive the negotiations which we are told are about to take place.
"We have spent the last 20 years forging various agreements which have placed the Irish peace process as one of the most successful peace processes in the world today.
"Anything that resembled a return to border checkpoints would represent a grievous undermining of the Good Friday Agreement."
Mrs Foster, the Democratic Unionist Party leader, said there needed to be a a "realistic way" of dealing with the Common Travel Area.
"When people talk about a hard border, I think they think back to the Troubles in Northern Ireland," she said.
"Our colleagues in the Republic of Ireland have said very clearly they want to make the Common Travel Area work.
"There are ways to deal with this that we can be creative and flexible about."
Northern Ireland Secretary James Brokenshire, Taoiseach (Irish prime minister) Enda Kenny and Scottish First Minister Nicola Sturgeon are among the figures attending Friday's meeting in Cardiff.
It is being hosted by Welsh First Minister Carwyn Jones.
Mr Jones said: "For the first time ever there'll be different immigration policies on both sides of the border.
"The Common Travel Area was based on having a common immigration policy that's not going to be there any more."
The talks are looking at how the devolved administrations can help each other during the Brexit process.
Other possible discussion topics include Mr Kenny's suggestion that Brexit could lead to a referendum on Irish reunification.