ROME, Feb. 21 -- After just nine months at the helm of a shaky government, Italian Prime Minister Romano Prodi handed in his resignation Wednesday when he lost a critical parliamentary vote over the government's foreign policy.

President Giorgio Napolitano asked Prodi to stay on as head of a caretaker government, and the day's frenetic events do not necessarily signal the end of Prodi's tenure as premier. Napolitano could ask him to try to form a new coalition after completing a round of consultations.

But Wednesday's vote did confirm the delicate nature of Prodi's disparate band of political allies, a fragility evident since the coalition's narrow victory last April.

The crisis in the center-left government opened up when a motion in the Senate to support a wide-ranging foreign policy address by Foreign Minister Massimo D'Alema failed by two votes. In that speech, D'Alema called for continuation of the Italian role in NATO's Afghanistan mission and the expansion of a U.S. military base in northern Italy because refusal would be "a hostile act towards the U.S.A."

When the motion received 158 votes rather than the required 160, the side of the Senate occupied by the conservative opposition reacted with joy and members began chanting, "Resignation! Resignation!"

Senators on the other side stood silent, stunned by their apparent miscalculation.

Even though the vote was not binding as a confidence vote, D'Alema had tried to rein in the far left ahead of time by declaring that failure to reach a majority on such a crucial issue would send the government home.

The Prodi coalition eked out a 25,000-vote victory against the incumbent government led by Silvio Berlusconi in April, resulting in a comfortable margin in the lower Chamber of Deputies but a one-seat majority in the Senate. The refusal of two far-left senators to abandon their antiwar positions for the sake of political survival in Wednesday's vote assured the resolution's defeat.

Prodi's coalition includes nine parties, from Communists to Christian Democrats, and has faced problems on nearly every issue it has confronted.

The coalition showed serious cracks last weekend over a protest in Vicenza, where the United States wants to expand an Army base to allow for additional battalions of the 173rd Airborne Brigade, which is to deploy to Afghanistan. Tens of thousands participated in the peaceful protest, which was encouraged by some members of the government.

Prodi and D'Alema had nevertheless garnered support from most of the cabinet to go along with the expansion.

Major divisions have also appeared over Afghanistan, where Italy has about 1,800 troops. Some far-left members of the government oppose any Italian military involvement there and have called for those troops to be withdrawn.

Prodi has not faced pressure only from the left. A recent government move toward allowing legal recognition of cohabitating couples and homosexual unions risked alienating the coalition's Catholic component.

Napolitano, the president, has a few options: calling for votes of confidence in the Prodi government in both houses; asking someone else to try to form a government; or calling for another round of elections.