Updated

Greece moved to end its protracted political impasse Wednesday, swearing in a new prime minister to lead a largely pro-bailout coalition tasked with saving the country's place in the eurozone and easing a European financial crisis with global repercussions.

Antonis Samaras, a 61-year-old U.S.-educated economist, became the fourth prime minister in eight months.

"I know well the need to restore the dignity of the Greek people that has been wounded," he said. "I know the need for a quick recovery of the economy to restore social justice and social cohesion."

Samaras, leader of the conservative New Democracy party, will head a three-party coalition that includes the socialist PASOK party and the small Democratic Left.

The new government faces massive financial challenges. It must deliver on pledges to implement painful austerity measures, including cutting tens of thousands of civil service jobs, in exchange for billions of dollars (euros) in rescue loans from other European countries and the International Monetary Fund.

"You are taking over the governance of the country at a difficult and historic moment. You have many battles to fight, both within Greece and abroad," the outgoing caretaker prime minister, Panagiotis Pikrammenos, told Samaras during their handover.

New Democracy narrowly beat the radical left-wing Syriza party in Sunday's elections, but fell short of enough votes to form a government on its own, leading to power-sharing talks for three days. Similar talks after an inconclusive May 6 election had collapsed after 10 days.

Syriza, led by 37-year-old former student activist Alexis Tsipras, had campaigned on an anti-bailout platform, vowing to pull Greece out of the commitments it made to impose deeply unpopular austerity measures in return for the multibillion-euro bailouts. Greece has been dependent on the bailout funds since May 2010.

Tapping into widespread anger at the austerity, Tsipras quadrupled his party's support since the 2009 elections and will now be the main opposition party — a role it has already said it will use to oppose the bailout.

"Syriza will fight from the position of responsible, active opposition," spokesman Panos Skourletis said after the coalition agreement was announced. "It will stand beside those who suffer from the policies being implemented and will lead the social struggles of the next phase in the effort of keeping alive the hope of overturning the bailout policies."

But with the formation of a largely pro-bailout government, immediate fears of Athens reneging on its pledges have receded. Combined, the coalition's three parties hold a strong majority of 179 out of Parliament's 300 seats — although it is unclear how united they will be. New Democracy and PASOK are longtime foes in a rivalry that extends from the early 1980s.

The new government faces a long, tough job. It must deliver on pledges by its predecessors to generate huge new savings, privatize publicly-owned companies and real estate, cut some 150,000 civil service jobs and open restricted professions to competition.

All three coalition parties broadly back Greece's pledges for further austerity and reforms, but have pledged to re-negotiate some of the terms for the rescue loans. Samaras campaigned on promises to lower taxes, restart the economy and provide income boosts to low earners, large families, police and fighter pilots.

New Democracy and PASOK, the party that came in third in Sunday's vote and is led by former finance minister Evangelos Venizelos, are also looking for an extension of at least two years in the deadlines for implementing fresh cutbacks worth a total €14.5 billion ($18.42 billion).

Fotis Kouvelis of the Democratic Left went further Wednesday, saying Greece should eventually "disengage" from the austerity commitments and "lift those measures that have literally bled society."

An initial test could come as early as Thursday, when the finance ministers of the 17-nation Eurozone meet in Luxembourg ahead of an EU summit on June 28-29. Greece will send outgoing finance minister Giorgos Zanias, who met Wednesday night with the heads of the three coalition parties. The meeting was also attended by National Bank of Greece chairman Vasilis Rapanos, tipped to succeed Zanias as finance minister.

The June 28-29 summit "will be the first big battle on the revision of the bailout agreement, the creation of a framework that will allow us to move to positive growth and to combat unemployment, which is the big problem of Greek society," Venizelos said.

The willingness of Greece's international creditors to soften some of the terms will be key. So far, while there have been some slightly conciliatory voices, it is unclear just how much tolerance there will be.

Dutch Prime Minister Mark Rutte, whose country has often taken a hard stance on the Greek crisis, said it was "good news" that a government had been put together quickly.

"It is important that Greece now takes the right measures to implement the agreements that we made in the eurogroup," he said after meeting German Chancellor Angela Merkel in Berlin. "I assume that these agreements will be adhered to."

Merkel, whose country is the main contributor to the bailout, called Samaras to congratulate him and wished him "luck and success in the difficult work that lies ahead of him," the German government said. It added that Merkel hopes for "good cooperation" with Samaras and his government, and she invited him to visit Berlin.

The austerity has left the country struggling through a fifth year of recession, with unemployment spiraling to above 22 percent and tens of thousands of businesses shutting down.

Earlier Wednesday, hundreds of poverty-stricken Greeks queued in a central Athens park for free vegetables. Cretan farmers handed out some 2,700 10-kilo (22-pound) packages of produce, in cooperation with the capital's municipal authorities.

Among those lining up was Panayiota Sidera, a 31-year-old unemployed Athenian whose husband is also out of a job. The couple lives on a €250 monthly disability pension and rent from an apartment they own, and has a €540-a-month loan installment to pay.

"That's my predicament," she said. The food handout "is helping people, and I'm grateful. ... The government should have been doing this years ago."

____

Nicholas Paphitis and Menelaos Hadjicostis in Athens and Geir Moulson in Berlin contributed.