Image copyright Getty Images Image caption Labour politicians are among those who have been calling for a further referendum on the European Union

A call for work to begin now to prepare for another referendum on EU membership has been backed by AMs.

The Welsh Government and Plaid Cymru motion came after MPs agreed they wanted changes to the part of Theresa May's Brexit deal designed to avoid Northern Ireland border checks.

The Senedd motion also says the timetable for leaving the EU should be extended to avoid "no-deal".

Welsh Conservatives said a further referendum would "solve nothing".

The motion, which stopped short of calling for a referendum now, was debated by AMs after First Minister Mark Drakeford met Theresa May and her cabinet in Westminster on Wednesday.

The assembly agreed: "If, as it now seems, the UK Parliament cannot unite around an alternative proposition which includes participation in the single market and a customs union then the only option which remains is to give the decision back to the people; and believes that work should begin immediately on preparing for a public vote."

Image caption First Minister Mark Drakeford arriving for his meeting with a Brexit sub-committee on Wednesday

The Welsh Government would prefer a Brexit deal that keeps a close economic relationship with the EU, with involvement in the single market and the customs union.

Mr Drakeford told BBC Wales his ministers still believe "there is still a deal there to be done, on which we can leave the European Union on terms that protect the Welsh economy and Welsh jobs, and that must be allowed time still to see whether we can bring that off".

"But if the House of Commons continues to be deadlocked and that idea finally runs into the sand, we have said that decision has to go back to the people," he said.

"And if that is to be a practical possibility, preparations have to begin now."

Asked why he had not backed a referendum outright, he said the House of Commons had not yet run out of time to conclude a deal that ministers could support.

"It is getting closer and closer with every week that seeps by," he said.

'Bewildering scenes'

Plaid Cymru leader Adam Price welcomed the move, which came as a result of talks between Labour and Plaid overnight.

"I'm sure that many people were horrified at seeing the bewildering scenes unfold in Westminster last night, that culminated in a paradoxical vote for an impossible Brexit," he said.

He said a new referendum would allow "the people to decide the way forward from here is the only way to solve the Brexit deadlock".

Media playback is unsupported on your device Media caption Reality Check unpacks the basics of the backstop.

The assembly debate followed votes in the Commons where MPs both stated their opposition to leaving the European Union without a deal, but also called for part of Theresa May's agreement with the European Union to be changed.

MPs, mostly from the Conservatives, called for "alternative arrangements" to the backstop - an insurance policy in the deal to prevent an Irish hard border.

Despite the demands from parliamentarians, President of the European Council Donald Tusk said the withdrawal agreement was not up for renegotiation.

Please upgrade your browser Your guide to Brexit jargon Enter the word or phrase you are looking for Search

Analysis by Felicity Evans, BBC Wales political correspondent

Today's motion in the Senedd marks another slight shift in a cautious journey by First Minister, Mark Drakeford.

He's under pressure from some in Welsh Labour to throw his weight behind a further Brexit referendum. As the departure date of 29 March looms, without any sign of a deal, the pressure increases - especially since he has described a no-deal departure as a "catastrophe" for the Welsh economy.

Plaid Cymru has been piling on the pressure too. And after talks with them last night, this joint motion calls for preparations for a public vote to begin "immediately".

But it doesn't call for a public vote to happen right now. That's important for the first minister because it allows him to stick (just about) to Labour leader Jeremy Corbyn's position, which is to keep the referendum option open without actually supporting it.

But Mr Drakeford's direction of travel seems clear and he's moving faster than UK Labour.

Will they catch up? Will he slow down? Or will he divert from the official route?

Image caption Gareth Bennett accused the Welsh Government of trying to "derail Brexit"

The leader of the Conservatives in Cardiff Bay Paul Davies urged political parties wanting to avoid a no-deal exit to "end their delusions of a second referendum - which will solve nothing and exacerbate everything - and vote for the only deal on the table".

UKIP's assembly group leader Gareth Bennett said: "Yet again, we see another desperate attempt by the Cardiff Bay Establishment to derail Brexit."

He called on the Welsh and UK governments to accept "we'll be leaving on World Trade Organisation terms on 29 March, and to now focus all of their efforts on preparing for this outcome, without the unnecessary theatrics of yet another side show orchestrated by Project Fear".

The Welsh Government's Liberal Democrat Education minister Kirsty Williams said: "The best way out of this mess is to go back to the people and give them a final say on Brexit with the option to stay in the EU. That is what the Welsh Liberal Democrats will continue to unequivocally fight for."

Earlier Welsh Secretary Alun Cairns said the European Commission needed to "work with us in order to come to a deal".

"We have seen in the past that the European Commission said they would not move from certain points. In the Withdrawal Agreement they have already agreed to move some way," he said.

"We have had to move in some areas and this is an issue where Parliament has come together, the prime minister acting in the national interest can now stand up to Mr Barnier [the commission's chief Brexit negotiator] and say 'this is what we need in order to get an agreement'."