Ousted President Manuel Zelaya said Friday that a U.S.-brokered pact will restore him to power in about a week, ending Honduras' isolation four months after soldiers flew the leftist leader into exile in his pajamas.

The agreement is a U.S. foreign policy victory but casts doubt on Latin America's ability to work out its own problems without Washington's help. In the four months since the coup, talks repeatedly broke down as the government of President Barack Obama tried to let Latin American governments take the lead.

In the end, the top U.S. envoy for the Americas flew in Wednesday and won a deal the following night — just a month before presidential elections the U.S. and other countries warned would not be recognized if held under the government that took power in the June 28 coup.

The power-sharing agreement calls for Congress to decide whether to reinstate Zelaya and allow him to serve the remaining three months of his term.

And while it imposed no deadline, Zelaya told The Associated Press on Friday he expects a decision in "more or less a week." Meanwhile, he said, he will remain at the Brazilian Embassy in Tegucigalpa, where he took refuge after slipping back into the country on Sept. 21.

"I'm not going anywhere," he said.

Assistant U.S. Secretary of State Thomas Shannon said the two sides finally made concessions after realizing the warning that the November election would not be recognized was serious.

"There was no more space for them to dither," Shannon said at a news conference in the Honduran capital, Tegucigalpa.

He cautioned "there are a variety of moving parts to this agreement" and said he would stay in Honduras while the two sides negotiate the details.

Negotiators submitted the agreement to Congress for consideration on Friday. While the legislature backed Zelaya's ouster, congressional leaders have since said they won't stand in the way of an agreement that ends Honduras' diplomatic isolation and legitimizes the presidential elections planned for Nov. 29.

Inside the Brazilian Embassy, backers hugged Zelaya after hearing news of the deal and one asked him to autograph a white cowboy hat resembling the one the deposed leader always wears. The hat already bore Shannon's signature.

Soldiers continued to surround the embassy and floodlights still interrupted sleep, but it has been several days since troops used earsplitting cat calls and howling dog noises in the wee hours to keep those inside awake.

The crisis has been diplomatic challenge for the Obama administration. In an effort to improve relations in a region where the United States is often criticized for heavy-handed meddling, Obama had emphasized that the Organization of American States should take the lead in resolving the crisis.

That did not prevent U.S. adversaries in the region from criticizing Obama. Venezuelan President Hugo Chavez condemned the United States for being too soft on the government of interim President Roberto Micheletti — even though the U.S. cut off millions of dollars in development and military aid and suspended the diplomatic visas of top Honduran officials.

Meanwhile, U.S. Republicans criticized Obama for condemning Zelaya's ouster, questioning why the U.S. was defending an ardent Chavez ally. Republican lawmakers have held up two Obama appointments over the dispute: Shannon as ambassador to Brazil and Arturo Valenzuela, Obama's pick to take Shannon's current job.

Shannon joked Friday with reporters that he plans to stay in Honduras "until the Senate confirms me."

The U.S.-brokered pact was a testament to the considerable sway Washington still holds over Latin American, despite vocal attempts by Chavez and other leaders to undermine U.S. influence.

The United States is by far the biggest source of direct foreign investment and development aid in Honduras, which also relies heavily on money sent home from immigrants in the U.S.

U.S. officials tried to downplay Washington's role. Speaking to reporters in Islamabad, Secretary of State Hillary Rodham Clinton called the developments "a big step forward for the inter-American system," and Shannon insisted the pact was "a huge accomplishment for Honduras."

But few other countries had any real power to pressure Micheletti.

On Friday, Jose Miguel Insulza, the secretary-general of the Organization of American States, acknowledged the "particularly important" contribution of the United States and Shannon in resolving the crisis.

He also praised Costa Rican President Oscar Arias, who months ago drew up a compromise agreement that served as the basis for talks. And Insulza said the OAS had "put all its efforts to finding a peaceful and consensual solution to the crisis."

Even so, the OAS made a few mistakes along the way that helped prevent the breakthrough from being a real victory of Latin American diplomacy, said Heather Berkman, an analyst with the Eurasia Group in Washington.

Insulza at first took a hard-line approach, trying to quickly put Zelaya back in office without reaching out to those who deposed him and listening to their reasons: fears that Zelaya was trying to change the constitution to extend his time in office. Zelaya has denied such intentions.

In the days following the coup, Insulza even abruptly offered to fly Zelaya back to Honduras himself. He ended up backing off from the offer, and Zelaya tried to fly back without him.

Military vehicles kept his Venezuelan pilots from landing at the airport, and a frustrated Zelaya exhorted the OAS, the U.N. and the U.S. to "do something about this repressive regime.

The OAS "made a series of blunders that diminished their credibility from the perspective of the interim government as a credible broker," Berkman said. "The events of this week show that the U.S. still has a relatively important role to play in regional relations."

"In the end, it took Tom Shannon to go down there and say, 'Look buddy, these elections aren't going to be recognized unless you have an agreement,"' she said.