Jobs and trade will be lost in Wales if it is easier to move goods into the EU via Northern Ireland than through Welsh ports after Brexit, the first minister has said.
Prime Minister Theresa May has spoken of a frictionless Irish border post-Brexit.
But Carwyn Jones said he would not support any deal that made it harder to move goods through Wales.
He was speaking on the BBC's Sunday Supplement programme.
Ms May said in January: "We need to find a solution which enables us to have as seamless and frictionless a border as possible between Northern Ireland and Ireland so that we can continue to see the trade, the everyday movements that we have seen up to now."
But Mr Jones said: "If there was a frictionless border... between north and south, if you were moving goods into the island of Ireland, you would then be tempted to go via Scotland or via Liverpool if we had customs posts and border control in the Welsh ports.
"So we need to make sure that goods are able to move between Wales and the Republic of Ireland on the same basis as they are between Northern Ireland and the Republic, or we lose trade and we lose jobs in the Welsh ports.
"What I would not support is any kind of deal where it's easier to move goods into the EU via Northern Ireland than through the Welsh ports."
Following a summit of British and Irish ministers on Brexit in November, Mr Jones said it was agreed there "should be no hard border" between the UK and the Republic of Ireland.
"Access to the single market is the most important issue," he said at the time.