Labour has voted by a big margin to back an historic coalition with Plaid Cymru in the Welsh assembly.
Rhodri Morgan arrives for the special Labour conference in Cardiff
The party agreed the deal by almost four to one at a special party conference in Cardiff.
It means Labour and Plaid will sit in the same Welsh Assembly Government cabinet if, as expected, Plaid also backs the agreement on Saturday.
It will create an unprecedented coalition between two parties which have often been bitterly opposed.
The vote came despite strong opposition from some Labour MPs, AMs and party members, including such figures as former party leader Lord Kinnock and ex-Welsh Secretary and Northern Ireland Secretary Paul Murphy.
First Minister Rhodri Morgan, whose leadership of the party in Wales could have been under threat if he had lost, said he was "very pleased" that both sides of the party had backed it.
The unions and affiliates were in favour by a margin of 19-1. The deal's supporters had feared the biggest threat would come from constituency parties and other groups, but they supported it by 2-1.
Mr Morgan said: "That gives a very good indication that the party will unite now behind this overwhelming vote."
The agreement with Plaid commits the parties to campaign for a Yes vote to turn the assembly into a Scottish-style parliament, but Mr Morgan said there would be no referendum until "they had tested the waters of public opinion".
Plaid's grassroots membership is now expected to follow suit and ratify the same "One Wales" agreement at a separate meeting in Ceredigion.
HOW WELSH LABOUR VOTED
Trade unions, affiliates: YES: 95.83%; NO: 4.17%
Constituency, county parties, women's forums: YES: 61.02%; NO: 38.98%
RESULT: YES: 78.43%; NO: 21.57%
That would be followed by a new coalition announced on Monday, with Plaid entering government for the first time.
Welsh Secretary Peter Hain said: "This was not a vote for nationalism nor was it a vote for independence: it was a vote to keep Welsh Labour at the heart of government".
Earlier, Mr Morgan had urged his party to vote with "heads and not with their hearts" and the conference hall atmosphere was described by one party member as very tense and fractious.
The assembly election on 3 May left Labour on 26 seats out of 60, with Plaid on 15, Conservatives 12, Liberal Democrats six and independent one.
Rhondda MP Chris Bryant said: "I spoke against the deal but now the party has reached a democratic decision I believe that the Labour Party must unite and go forwards and get on with the really important work that Rhodri and his colleagues have to do in the country."
Cardiff North MP Julie Morgan, who is married to Rhodri Morgan, said she was very pleased with an "absolutely decisive" result.
She said the debate was "held in good humour" with "a lot of passion and very strong feelings," but there was also "a general feeling that everyone would unite around the decision."
Mrs Morgan said her husband had been "amazingly calm" during negotiations which had gone on "day in, day out".
'ONE WALES' PROPOSALS
To increase affordable housing
Improve road and rail links between north and south Wales
Referendum on full law-making assembly powers "as soon as practicable" in or before 2011
Labour and Plaid agree "in good faith to campaign for a successful outcome" to a referendum
Moratorium on existing plans for community hospital changes
A commission to tackle climate change
She said: "The reality of the (assembly election) result means that we have to work with other parties. The Liberal Democrats are not interested in working in a coalition and Plaid Cymru are interested.
"People throughout Europe are used to working in coalitions. It's very common over there and we are going to have to get used to doing it here."
Plaid deputy leader Rhodri Glyn Thomas was "very pleased" with the outcome, which he said showed Labour saw the deal "as a progressive programme of government and they have embraced it with enthusiasm."
Welsh Conservative leader Nick Bourne said the voted showed "significant opposition" within Labour and predicted that Mr Morgan "could find it easier to deal with his potential coalition partners than many members of his own party."
Liberal Democrats had initially rejected their own coalition with Labour, and Lib Dem AM Kirsty Williams said she was disappointed her party would not play a part in governing Wales.
Ms Williams said the Lib Dems "must step up to the plate now and make sure we are an effective opposition".
The deal was backed by both party executives but opposed by four Labour AMs and some MPs, including Don Touhig, who said it would be "suicide" and a "trap".
The One Wales 43-page document was supported by most of each party's AMs, but there were doubts on both sides, and most Welsh Labour MPs had "serious concerns".
AMs Lynne Neagle, Karen Sinclair, Ann Jones and Irene James broke ranks with fellow Labour AMs to oppose it.
The four AMs were particularly opposed to the part of the document on a referendum on a Scottish-style parliament by 2011.
Plaid supporters of the deal argued such an early referendum would not have been attainable had the party opted to enter a "rainbow coalition" with the Liberal Democrats and the Conservatives.