Congress cleared legislation Tuesday that would curb President Bush's power to appoint prosecutors indefinitely, resolving one controversy linked to the firing of federal prosecutors.

The 306-114 vote gave the House's blessing to the Senate-passed bill, readying it for Bush's expected signature. It will close a loophole that Democrats say could have permitted the White House to reward GOP loyalists with plum jobs as U.S. attorneys.

The measure would restore the process for temporarily replacing U.S. attorneys to what it was before Congress reauthorized the Patriot Act last year. Under the bill, the attorney general could appoint a temporary replacement who could serve for up to 120 days. If in that time the Senate did not confirm a nominee permanently, the chief judge of the federal district would appoint a temporary replacement until the Senate acted.

Congress renewed the Patriot Act last year with a new provision that allowed the president to appoint U.S. attorneys for an indefinite amount of time, thus avoiding Senate confirmation. Democrats say the White House tried to use that provision to fire troublesome prosecutors and replace them with loyalists.

Attorney General Alberto Gonzales has insisted that his intent is to submit all nominations to the Senate for confirmation. But e-mails released by the Justice Department in recent months indicate that some of his aides were aware that the provision could be useful in a fight with majority Democrats.

The House vote is but one front Democrats are fighting in what they say is the White House's infusion of politics into law enforcement, specifically whether Gonzales let the administration improperly politicize the Justice Department. Some lawmakers, including Republicans, have suggested that the flap over prosecutors has weakened Gonzales too much to run Justice.

White House press secretary Tony Snow disagreed.

"I don't think he's a distraction," Snow said, adding that Gonzales is doing his job effectively. "A lot of people have been trying very hard to turn this into a big story, to no avail."

The vote came during a period of eroding support and new hurdles for Gonzales. Senate Democrats are proposing a no-confidence vote on the attorney general, perhaps at week's end. And Gonzales' former White House liaison, Monica Goodling, is expected to tell her story Wednesday under a grant of immunity.

In advance of her testimony, the Justice Department released hundreds more documents, some of which showed that Goodling approved White House aide Chris Oprison's suggestion that department talking points be given to Mark McKinnon — a media strategist who worked with presidential adviser Karl Rove during Bush's campaigns.

Nearly every day in the past week has brought new calls for Gonzales' resignation, most from Democrats though five have come from Republican senators.

On Tuesday, freshman Sen. Jon Tester, D-Mont., said Gonzales "no longer enjoys the confidence of the Congress or the American people that he can effectively serve as America's top law enforcement officer."

Montana's other Democratic senator, Max Baucus, said the attorney general "has created a situation that doesn't reflect well on his office or the country" but stopped short of calling for him to resign.

Bush on Monday sounded exasperated by what he called the "political theater" of the mess and declared he would stand by Gonzales because the attorney general had done nothing wrong.