As the war in Iraq was beginning, Russian President Vladimir Putin sharply condemned the U.S.-led operation as unwarranted, unjustifiable and a bad mistake. He warned against the "rule of the fist" and strongly criticized violations of the principle of state sovereignty.

Two weeks later his tone has changed dramatically. Taking a pragmatic approach to foreign policy, he firmly stated that Russia would continue its political cooperation with the United States. He emphasized the importance of economic and trade ties with America. Putin said he understands his people's emotions regarding the war in Iraq and "partly shares them -- especially after watching TV reports from the battle areas." But, he added, "emotions are a bad adviser in decision-taking."

This change of tone illustrates a tricky balancing act that Putin and other Kremlin policymakers are forced to attempt.

On the one hand, Putin seems to be fully determined to integrate Russia into the world economy. He opted for this course after 9/11, and he has not deviated from it. Nor is he opposed to the idea of using military force, bombing cities or inflicting civilian casualties: His three-year conduct of the war in Chechnya provides abundant evidence of that.

Yet on the other hand, the Russian president has to deal with anti-American sentiment among the public and parts of the elite. The public may remain relatively passive -- there have been no street protests to speak of -- but polls show strong antiwar, or anti-American, feelings. Never under Putin's rule has the percentage of Russians taking a negative attitude toward America been so high: It has even exceeded the peak reached under Boris Yeltsin at the time of NATO bombing in Yugoslavia. The media have generally assumed an anti-American tone, and an interactive vote on a popular Sunday news show yielded an astounding result: Eighty percent of the relatively liberal audience said they hoped Iraq, rather than the United States, would win the war.

Given Russia's weak civil society, policymakers, including the president, can ignore the public easily enough. But once in a while public opinion in Russia becomes important. This occurs, of course, around elections.

The parliamentary election is scheduled for December, and the campaign has already begun. The competition, just as it was four years ago, will be between the Communists and the pro-Kremlin party, created, guided and controlled by the Kremlin. The Kremlin manipulators need nothing short of a solid victory over the Communists, having come in about 1 percent behind them in 1999. Unless they do significantly better this time, Putin's much-vaunted stability and claims to economic progress will be seen as not having made much of a difference.

Right now the situation does not look good for the pro-Kremlin party: The most recent national poll put its popularity rating at 21 percent and that of its Communist rivals at 31 percent. The Communists are not missing the opportunity to capitalize on anti-American feeling. Anti-American rhetoric, which portrays the United States as an evildoer seeking to destroy Russia, has an irresistible appeal for their constituency. Putin's aides in charge of the pro-Kremlin party are fully aware of this, as well as of the broader public frustration over American hegemony.

Before the war, the Kremlin pursued a policy of playing down the U.S. standoff with Iraq so as to keep a lid on the public's anti-American feelings. But as soon as the operation started, and war images began appearing on TV, this was no longer an option.

The tough statement Putin made right after the beginning of the war immediately unleashed a wave of fierce anti-American rhetoric from conservative elites, who after 9/11 had learned to withhold their opinion and would not dare challenge Putin's pro-American position. Both chambers of the Russian Parliament passed angry resolutions denouncing the war in Iraq. Though in no way binding on the Kremlin, these resolutions are important as reflections of prevailing sentiment.

But as this sentiment grew, so did Kremlin concern that it might interfere with the urgent need to repair relations with the United States, damaged after Russia's refusal to support the war in Iraq. Efforts have been made to calm the mood and send a signal to both the media and the conservatives not to be deluded by Putin's earlier statement: The president is still firm on his course to integrate with America. These efforts were made somewhat easier by the expectation that the war may soon be over, raised by the fast advance of the U.S. forces and their concentration around Baghdad. Since Putin made his statement calling for pragmatism, the tone of the media has become softer.

In Russia anti-American sentiment is not very deep. It derives not from any profound cultural hostility but rather from frustration over the loss of superpower parity with the United States. Even now at the height of bad feeling toward America, most of those polled believe the pre-war relations between the two countries will be resumed. But the new rift between Russia and America has become rather wide, and the new surge of anti-American feelings will take a while to subside. This promises to be a tough job for the pragmatic, Westernizing wing in Russia's political establishment.

Masha Lipman, a Russian journalist, writes a monthly column for The Post.