Chancellor Gerhard Schroeder won a vote of confidence in the lower house of parliament Friday, securing a narrow majority that both bolsters his coalition government and approves a German deployment in the U.S.-led war on terrorism.

Lawmakers voted 336-326 to back Schroeder's motion, which also pledged 3,900 troops to the U.S.-led campaign.

The governing coalition needed a majority of all lawmakers in the 666-seat legislature -- 334 votes -- to survive. The alliance of Schroeder's Social Democrats and the Greens party has 341 seats. Four lawmakers didn't vote.

With some pacifists in his coalition stubbornly opposing what would be Germany's largest foray outside Europe since World War II, Schroeder opted for the confidence vote -- only the fourth in postwar Germany -- rather than accepting approval of the deployment on the strength of opposition support.

In a speech to the full parliament, Schroeder urged lawmakers in his coalition to back the military deployment -- thereby reinforcing the government -- in a signal to the world of Germany's reliability in the international fight against terrorism. The pledge does not involve ground troops or participation in airstrikes.

"Today's decision on the military deployment will certainly be a turning point: for the first time soldiers will be readied for armed deployment outside the NATO region," Schroeder said. "For a decision of such consequences, it is absolutely necessary that the chancellor and the government relies on a majority from their own coalition."

Schroeder's Social Democrats favored new elections if Friday's vote failed.

With the military deployment tied to a confidence vote, the opposition vowed to vote against rather than support the chancellor. They complained the chancellor's gamble has harmed Germany's image abroad.

"You are playing thoughtlessly with foreign policy because you cannot manage your domestic policies, in a last-ditch effort to save your government," the conservative Christian Democrats' parliamentary leader, Friedrich Merz, said. "Such a chancellor doesn't deserve trust."

With a government majority of just 16, the chancellor left dissenters little room for maneuver.

The outcome of the vote was on a knife-edge going into Friday's session.

Straw polls of the coalition factions in parliament early Friday indicated Schroeder likely would win. His Social Democrats, except for one lawmaker, closed ranks and only four Greens -- out of eight who had said they would oppose the military pledge -- opposed the deployment ahead of the vote.

"We all believe that the war in Afghanistan is wrong," Greens left-winger Hans-Christian Stroebele, who said he would vote against, told Phoenix television.

"We're trying to make it clear by splitting our votes that we are for one thing but against the other."

As about 60 anti-war protesters demonstrated outside, Greens leaders made impassioned pleas to lawmakers to back Schroeder.

"The decision as to whether this government wins is a decision on the future of this country -- whether we can continue the ecological and social renewal of this country," Foreign Minister Joschka Fischer said. "Germany needs this policy."

New elections would have presented risks for the opposition Christian Democrats, now engaged in an uncomfortable debate on whether chairwoman Angela Merkel or two rivals should be the next chancellor candidate.

And an early ballot would be dangerous for the Greens, who have lost support in a series of state elections as they made uncomfortable decisions over military operations and the gradual phasing out of nuclear power.

Only the ex-communist Party of Democratic Socialism has opposed outright Schroeder's pledge of "unrestricted solidarity" with the United States since the Sept. 11 terror attacks.

"With today's decision, we are heading into a military adventure with risks that can't be calculated," said their parliamentary leader, Roland Claus.

Schroeder's coalition has survived repeated bouts of tension over sending German forces to the Balkans in recent years, with Fischer among the most ardent backers of deployments aimed at curbing greater threats.

Still, some pacifist Greens and Social Democrats viewed the latest mandate as too sweeping, while others question the U.S. strategy of striking Afghan targets to root out terrorism.

Schroeder offered special forces, ships, a medical evacuation unit and armored vehicles equipped to detect nuclear, chemical and germ warfare, gaining authority for an initial one-year deployment to an area extending from northeast Africa to central Asia.

A survey by the Wahlen research group for ZDF television, released Thursday, showed 59 percent of Germans favor the military deployment and 36 percent oppose it. The telephone poll of 1,098 voters was carried out between Monday and Wednesday.