Now they face the daunting task of doing that without hurting the fragile global recovery.

The world's most powerful leaders emerged from the G20 Summit with an agreement for advanced economies to cut their deficits in half by 2013 and stabilize their debt loads by 2016.

"The G20 still has a lot to do to fully entrench the global recovery, but these are important steps forward and, as you know, they are steps that Canada was seeking," said Prime Minister Stephen Harper, who spearheaded the deficit-fighting plan.

He told Sunday's closing news conference he expects Canada will reach both targets next year.

Harper, along with like-minded allies, had to convince colleagues that were worried the belt-tightening will hurt global trade and undermine the recovery. To ease such concerns, the communique is full of words of caution, warning cutting too deep or too fast could throw the world into turmoil once again.

"We have to make sure we're not rushing too quickly to the exits and all at the same time," said U.S. President Barack Obama, who had been pushing for a slow removal of stimulus measures.

"Our fiscal health tomorrow will rest in no small measure on our ability to create jobs today."

To balance the advanced countries' austerity pact, emerging markets have agreed to pull their weight in the recovery efforts. In particular, they agreed to greater exchange rate flexibility and measures to strengthen their social safety nets.

The deal was more good news for Harper who emerged from the G8 Summit Saturday with support for his Third World maternal-and-child health initiative - despite controversy over his insistence Canada will not let its money go to pay for abortions.

The $5 billion committed was far less than many had hoped for, but insiders say Harper never aspired to more than that, given the fiscal straits many of the G8 countries are in.

The G8 Summit, held in cottage country north of Toronto, focused on security. It's 43-point communique admonished Iran and North Korea for their nuclear activities and oppressive regimes.

Presidents, prime ministers - and one king - arrived for the G20 working dinner Saturday as chaos swirled around the heavily secured summit site in the heart of downtown. A plume of smoke rose into the air as bands of roving militants smashed shop windows, taunted police, and set cruisers ablaze.

But Canada's biggest city had settled into an uneasy calm by Sunday morning and the G20 Summit wrapped up in relative peace. After being criticized for letting things get out of control a day earlier, police cracked down on even peaceful protesters. By Sunday evening, the weekend arrest total topped 560.

The government has come under heavy criticism for spending $1.24 billion on the summits - more than its new commitment for the centrepiece maternal health initiative - including $930 million for security.

French President Nicolas Sarkozy didn't do Harper any favours, boasting Saturday he will spend "10 times less" at next year's G8 summit in Nice, France. On Sunday, he questioned the value of the G20 communique, saying deficit reduction hasn't been written in stone.

The communique also commits emerging countries to greater exchange rate flexibility, although it doesn't mention China by name. The United States, Europe and Canada have pleaded with China to allow its exchange rate to fluctuate more freely, and to implement measures that would encourage Chinese people to save less and spend more.

"Surplus economies will undertake reforms to reduce their reliance on external demand and focus more on domestic sources of growth," the communique says.

The agreement was a painful one to negotiate. China bristles when other countries try to tell it what to do with its exchange rate. And many countries fear that the austerity measures will hurt domestic economies at a time when they are most fragile.

That's why the communique stressed repeatedly that the austerity measures must be designed to enhance long-term growth prospects.

In other words, the deficits should not be reduced by raising taxes on incomes or businesses, but rather by cutting government spending, boosting productivity or possibly raising consumption taxes, according to advice from the International Monetary Fund.

For now, the targets are regional and vague. But the G20 countries also promised to put forward country-specific plans in time for the next summit in Seoul in November.

If the G20 is successful, an IMF analysis says their co-operation should boost global output by US$4 trillion, create tens of millions of jobs, lift even more people out of poverty, and stabilize global growth.

The G20 also made progress on reforms for financial institutions. They agreed to speed up measures to strengthen bank balance sheets. And they agreed on principles that would make sure taxpayers aren't left with the bill if banks go belly up.

The list of principles was a win for Harper, who has fought vehemently against European attempts to impose a global bank tax. Under the guidelines, they can still impose a tax if they want, but Canada doesn't have to.

Other key measures agreed to by the G20 include:

Setting up a working group on international development issues, the first time the G20 has given itself a formalized a role in helping poor countries.

Reaffirming some of the countries' support for the Copenhagen Accord to control greenhouse gas emissions.