Opening the Welsh market to cheap food from abroad after Brexit would have a "detrimental effect" on Welsh farmers, the first minister has said.
Carwyn Jones said the agricultural sector would struggle to compete if post-Brexit trade deals led to "unrestricted flows of food".
Mr Jones wants the UK to remain in a permanent customs union with the EU.
But Theresa May insists the UK must leave the customs union to strike trade deals with other countries.
The Brexit negotiations are currently deadlocked over the details of a customs union "backstop" or insurance policy for the Irish border.
There is disagreement on whether the "backstop" they have agreed to put in place should apply to Northern Ireland, or the whole of the UK - and on whether it can be time-limited or revoked by the UK.
Tory Brexiteers are concerned the UK could end up locked in a customs union with the EU without a fixed end point, which has been rejected by the EU.
Giving evidence to the Welsh Assembly's External Affairs Committee, Carwyn Jones said he could support "a temporary customs union without a set date".
"Because what I think what's important is that the UK takes a decision if it wants to leave the customs union at a time that's right for the UK, not at a time that's dictated by a particular timescale," he said.
Welsh Conservative Group member Mark Reckless said one of the reasons the EU wanted to keep the UK in a customs union was to restrict the country's ability to buy food "more cheaply from overseas".
But the first minister urged caution, adding: "If we're saying what we want to do is import cheaper food stuffs from other countries without any restriction, well our farmers aren't going to compete with that.
"Our agriculture industry is in the same position as agriculture everywhere else in EU.
"If we were to allow unrestricted flows of food, quite often of far lower quality, produced to far lower standards at lower cost into our market, our farmers won't compete with that."
Asked if he was "confident there will be an agreement", Mr Jones said: "I'm not. I just see what I read in the papers.
"I'm very wary when people say we're 95% of the way there. Well, the reality is that you have to be 100% of the way there."