Opposition parties blocked the return of Labour leader Carwyn Jones as First Minister on the Welsh Assembly's first day back since the election.
Mr Jones was expected to retain his post as Wales' premier politician in the Senedd but rival parties refused to give him their backing and instead all voted for Plaid Cymru's Leanne Wood.
Labour missed out on winning an overall majority during last week's election after winning 29 seats.
With Mr Jones unable to vote for himself, the votes ended up tied at 29 a piece - with Labour being saved from an embarrassing first day back in business thanks to support from the sole Liberal Democrat AM Kirsty Williams.
Plaid's nomination for Ms Wood was supported by the Conservatives and Ukip.
A Plaid spokeswoman said: "Wales chose not to elect one single party to govern Wales with a majority.
"As is the convention, the biggest party were given an opportunity to reach an agreement on forming a government which could lead Wales with the support of the majority of members in the National Assembly.
"They took the decision not to pursue that option, and were not prepared to give the process of negotiation any further time.
"As a result, the Plaid Cymru group followed normal Parliamentary protocol and nominated Leanne Wood for First Minister."
Plaid said it had notified Labour of its plan yesterday and said it had no formal discussions with Mr Jones.
"This afternoon, the Assembly failed to reach agreement on who should become First Minister and form the next government," added the spokeswoman.
"It is now for the parties to discuss this matter further in order to seek the best outcome for Wales."
Former barrister Mr Jones was appointed as First Minister in 2009 - succeeding Labour veteran Rhodri Morgan.
Since being at the helm, the 48-year-old has survived two elections as well as fended off attacks of his government's NHS record.
Despite losing one seat at last week's poll, Mr Jones has indicated he was looking to form a minority government - and possibly do deals with either Plaid or the Lib Dems on specific votes as has happened in the past.
Signs that Labour would not do any coalition deal does not look to have gone down well with Plaid - who tried to oust Mr Jones by putting forward Leanne Wood as his successor.
And despite being at opposite ends of the political spectrum, the left of centre Welsh Nationalist's plan was backed by right wingers the Tories and Ukip.
However, Lib Dem leader Ms Williams - one of Mr Jones' fiercest critics, was not impressed.
She said: "I was not re-elected into the Assembly to support a rag tag coalition of Ukip members, who at the moment can't even agree with one another.
"The reality is that Labour have 29 Assembly Members.
"They have the strongest mandate from the people of Wales."
Under Assembly rules, AMs have 28 days following the election to decide on a first minister.
If there is no agreement, the UK government's Welsh Secretary can call a fresh election.
Mr Jones will remain as First Minister until AMs vote to reappoint or replace him.
The uncertainty surrounding his position gave an unexpected twist to the Assembly's first day back.
All eyes were set to be on the internal problems surrounding Ukip - who took their Senedd seats for the first time.
Ahead of today's plenary session the party had been at loggerheads over the decision to appoint former MP Neil Hamilton as its leader in the Welsh Assembly instead of one-time MEP Nathan Gill.
Mr Hamilton's appointment was slammed by party leader Nigel Farage and also prompted the resignation of Ukip secretary Keith Thatcher.
Mr Thatcher said: "Neil Hamilton most certainly should have never been a candidate for Ukip in Wales and the success of Ukip in Wales has absolutely nothing whatsoever to do with Neil Hamilton."