The International Monetary Fund agreed Thursday to contribute $36 billion toward the latest bailout of Greece, deepening the agency’s financial exposure to a country that has become one of its most difficult rescue projects.

The IMF loans will be doled out over four years alongside more than $170 billion provided by other European governments and institutions.

Combined, the money is meant to keep the heavily indebted Greek government afloat for four years while it restructures its economy, trims public payrolls and spending, and grapples with a deep recession.

IMF officials said the new program should help restore stability. Over the past two years, Greece’s economic growth has cratered, and private holders of Greek bonds have absorbed the first-ever losses on government debt in the 17-nation euro region. At the same time, an initial IMF-led bailout of Greece ran aground.

Poul Thomsen, who heads the IMF’s mission for Greece, said Thursday that the country’s problems no longer seem as dire and that the risk to the broader European economy also appears to be lessening. “There is a clear sense of much reduced risk,” he said in a conference call after the IMF executive board, as expected, approved the new rescue program.

But Thomsen and others at the agency cautioned that the situation remains precarious. If the Greek economy does not respond as expected or political leaders fail to follow through on promised reforms, the country could quickly fall behind again. “Greece has no room for maneuver,” Thomsen said.

In a written statement, IMF Managing Director Christine Lagarde called the risks to the program “exceptionally high.”

The IMF’s rescue effort for Greece has been among the agency’s more contentious programs. Executive board members from countries such as India and Brazil have criticized the money involved — far more, in relation to the size of the Greek economy, than was spent on rescue programs in Latin America and Asia. The failure of Greek politicians to make promised changes has also drawn fire inside the agency.

Republicans in the U.S. Congress have seized on the difficulties as well, complicating the Obama administration’s plans to push a boost in IMF funding through Capitol Hill.

But the Greek bailout has been central to the IMF’s broader efforts to address the European debt crisis, which has threatened to pull apart the euro-currency union.

The IMF now has rescue programs underway in Portugal and Ireland as well as Greece, and it has pressed the cash-strapped governments of Italy and Spain to make budget cuts and changes in economic policy.

The European Central Bank has taken steps to support the region’s financial system while European leaders have approved changes to impose greater regional control over individual countries’ budgets. Taken together, these measures have given European officials increasing confidence that the worst of their crisis is over.

Last week, Greece came to terms with investors over a bond exchange program in which private holders of Greek bonds accepted losses of more than 50 percent. Some European officials had feared such a debt restructuring would wreck financial markets in the region, but no such turmoil has ensued.

In the meantime, borrowing rates for Italy and Spain have dropped from their crisis peaks of last fall.