Updated

Deposed President Manuel Zelaya and his opponents have agreed to a U.S.-brokered deal that he said will return him to power four months after a coup shook faith in Latin America's young democracies.

The power-sharing agreement reached late Thursday calls for Congress to decide whether to reinstate the leftist Zelaya. While the legislature backed his June 28 ouster, congressional leaders have since said they won't stand in the way of an agreement that ends Honduras' diplomatic isolation and legitimizes presidential elections planned for November.

"We are willing to be cooperative in Congress with the agreement of the negotiators," Porfirio Lobo, a National Party lawmaker who is favored to win the Nov. 29 presidential elections, said Friday. "The best decision for Honduras will be taken."

While officials did not explicitly say the deal would return Zelaya to power to serve out the remaining three months of his term, the ousted president was clearly confident that it will.

"This signifies my return to power in the coming days, and peace for Honduras," Zelaya told opposition Radio Globo.

Zelaya told The Associated Press that he expects Congress will take "a week or so" to make its decision. In the meantime, he said he will remain at the Brazilian Embassy in Tegucigalpa, where he took refuge after slipping back into the country from his forced exile.

"I'm not going anywhere," he said Friday surrounded by jubilant supporters.

Soldiers still surrounded the embassy and floodlights still interrupted sleep but it has been several days since troops have crowed and meowed in the wee hours to keep those inside awake.

Backers hugged Zelaya after hearing the news and one asked him to autograph a white cowboy hat resembling the one the deposed leader always wears.

The hat had already been signed by the top U.S. envoy for the Americas, Thomas Shannon, who led a delegation to Honduras this week to pressure the two sides to resolve the crisis after months of diplomacy failed to break the stalemate.

The breakthrough was a major foreign-policy victory for Obama. Speaking to reporters in Islamabad, U.S. Secretary of State Hillary Rodham Clinton called it "an historic agreement," noting: "This is a big step forward for the inter-American system."

Interim President Roberto Micheletti's government, which had argued that any decision rested in the hands of the hard-line Supreme Court, softened his position.

Zelaya was ousted after ignoring orders from the Supreme Court to abandon a referendum aimed at rewriting the constitution. Opponents said his secret plan was to lift a constitutional ban on presidential re-election; Zelaya denies that.

Zelaya had increasingly alienated Honduras' elite by forming an increasingly strong alliance with Venezuela's socialist president, Hugo Chavez.

The new agreement would create a power-sharing government and bind both sides to recognize the presidential elections. The international community had said it would not recognize the vote if Zelaya were not reinstated, raising the prospect of continuing political chaos in one of the Americas' poorest countries.

With the accord came international acceptance of the elections: Victor Rico, political affairs secretary of the Organization of American States, said "the United States and the OAS will accompany Honduras in the elections."

Micheletti called the pact a "significant concession" on his part, and said that one point would require foreign powers to drop sanctions or aid cutoffs imposed after the coup, and send observers to the elections.

Zelaya was flown out of the country by soldiers at gunpoint, but slipped back in Sept. 21 and took refuge at the Brazilian Embassy in Tegucigalpa.