His nation is exhausted. The economy is in ruins. He has been charged with crimes against humanity. But in the end, Yugoslav President Slobodan Milosevic accepted a Western-inspired peace plan for Kosovo after what appears to have been a cool calculation that he had nothing to gain from further warfare.

Without an agreement, Milosevic faced many more weeks of NATO bombing and a possible ground invasion with incalculable costs for him and for Serb-dominated Yugoslavia. As it is, the agreement Milosevic accepted contains several important carrots that enable him to claim a kind of victory, or put the best face on defeat. Most important, it ensures Serbian sovereignty over the largely ethnic Albanian-populated province of Kosovo, a point that was in doubt three months ago when Washington presented an initial ultimatum to Belgrade.

But while the Belgrade leadership can draw comfort from certain aspects of the peace plan, there is no disguising the fact that they have been forced to swallow something they swore they would never accept. Milosevic's opponents are already seizing on the agreement to admit NATO peacekeeping troops to Kosovo as evidence of a huge political defeat.

"What we are witnessing here is the final failure of the Serbian nationalistic politicians who voted for war 2 1/2 months ago," said Dragan Veselinov, the leader of a small regional opposition party in the Serbian parliament. "Seventy days ago, they were saying that not a single foreign soldier would enter the country. Today, not even they know how many will end up coming here."

Milosevic's decision to opt for peace rather than continued war with NATO is likely to throw politics here into turmoil. The immediate loser is the extreme nationalist Serbian Radical Party, led by Vojislav Seselj, which has announced it will pull out of the ruling coalition led by Milosevic's Socialist Party before the arrival of the first NATO troops in Kosovo. To preserve his parliamentary majority, Milosevic will be obliged to rely on the support of the Serbian Renewal Party, headed by Vuk Draskovic, who favors close ties with the West.

The long-term consequences of this political upheaval are difficult to predict. "Under war conditions, people gather around the leader, no matter who he is," said sociologist Ognjen Pribicevic. "There is quite a new situation now. People want peace. Everything will be different, but the political consequences will take time to sort themselves out."

Even though the change of heart in Belgrade took many in the West by surprise, signs have been mounting here for weeks that Milosevic was looking for a political solution to the crisis. The subtle shifts in the official position coincided with evidence of increasing war-weariness among the public at large and signs of discontent, particularly in southern Serbia, over the human costs of the war.

"Everybody got sick and tired of this war," said Predrag Simic, a Belgrade foreign policy expert and adviser to Draskovic. "Continuing the war through the summer would only have meant further destruction and perhaps even a NATO ground invasion. Milosevic found the right moment to do something that he has probably been preparing to do for some time."

Milosevic supporters said today that the current plan is more favorable to Belgrade than an agreement rejected by Milosevic three months ago, triggering the NATO bombing. In that plan, presented at peace talks in Rambouillet, France, the Clinton administration agreed to include a clause that provided for some popular consultation on the future political status of Kosovo following a three-year transitional period.

Political leaders here interpreted this as tantamount to independence for Kosovo "by the back door," given the overwhelming ethnic Albanian majority in the province and the likelihood that most would vote for secession from Serbia. The latest peace proposals make no mention of a referendum on Kosovo's future.

Other language that Belgrade found offensive in the initial peace plan also has been dropped. "This document is better" than the plan presented to Yugoslav and Kosovo Albanian negotiators at Rambouillet, said Yugoslav official Goran Matic, who frequently speaks for Milosevic. "Two months ago, what was on offer to us was independence for Kosovo. . . . [Rambouillet] meant the occupation of the whole country by NATO. This document only allows for foreign troops on part of our territory, under United Nations auspices, with a guarantee for the sovereignty and territorial integrity of Yugoslavia."

While it is true that western leaders gravely underestimated Belgrade's staying power, it is also true that Milosevic made an equally serious miscalculation of the staying power of NATO. His best hope of winning the war lay in dividing the alliance and hoping that Western governments would not have the stomach for a prolonged bombing campaign. As it turned out, public support for the war in most Western countries remained fairly high, the result in large measure of popular revulsion over reported atrocities by government forces in Kosovo.

Russia's decision to back key elements of the NATO peace plan had the effect of increasing Belgrade's international isolation, according to political analysts here. "The Russians put a knife under Milosevic's throat," said Ljiljana Smajlovic, a leading journalist. "He had been hoping for more support from Russia, but the help never came."

CAPTION: Slobodan Milosevic, right, consults with Serbian President Milan Milutinovic during discussions in Belgrade with envoys from Russia and European Union.