As I watched the burial service for Boris Yeltsin in Moscow, I thought back to his visit to Philadelphia in 1989.

This was not a bit of parochial musing. His 1989 trip to America - misreported at the time as a drunken junket - perfectly captured the contradictions of the man and the crucial legacy he left Russia. Yeltsin was a flawed human being but also a revolutionary figure. He presided over the collapse of the Soviet Union with almost no bloodshed, an amazing feat given the brutal history of the regime.

Unknown to the world, he was already grappling with how to dismantle the moribund Soviet system when he visited Philadelphia's Independence Hall.

By 1989, Yeltsin had already shown himself to be a maverick in the Communist system, a leader who rode buses and subways and denounced the privileges of the elites. He had risen up through the Communist Party all the way to a seat on the Politburo. Yet he grasped that the party's craven obeisance to top leaders left it incapable of reform, despite Mikhail Gorbachev's perestroika. He quit the Politburo and fell into disgrace in 1987 after denouncing the reforms as too slow.

But Yeltsin's daring gesture won him popular support. He was overwhelmingly elected to the Soviet parliament from Moscow in 1989. When he made his first U.S. visit that year, he was trim and erect, with none of the puffiness and paunch for which he later became famous. He may have been drunk in Baltimore, but he was stone sober in Philly.

I followed him around Independence Historic Park from the Liberty Bell into Independence Hall. We stood in the room with the 13 desks where the Founding Fathers wrote the Constitution. Then Yeltsin began to bombard the park ranger, via a translator, with questions about how the document's authors conceived of power-sharing between the central government and the states.

The Soviet Union at the time was made up of 15 republics, including Russia. Many of these republics, such as Ukraine and the Baltics, were restless under Soviet control. Yeltsin kept asking, "Did the center give the power to the states, or did the states give the power to the center?"

I didn't realize then that Yeltsin's questions meant he was already thinking about ending the Soviet Union. If power rested with the states (or Soviet republics), they could withdraw that power from the center. In December 1991, as the Russian federal republic's first elected president, Yeltsin, along with leaders of other federal republics, would declare the Soviet Union extinct.

Yeltsin's 1989 trip to the United States made other lasting impressions. Coming from a state-controlled economy, where people queued for hours for basic foods, he was stunned by the profusion of fruits and vegetables in American supermarkets. That probably affected his later determination, as the first elected president of post-Soviet Russia, to swiftly dismantle the old Soviet economic system.

We all know the many criticisms directed against Yeltsin. He failed to solidify democratic institutions and ordered tanks to fire on the hard-line parliament in 1993. He began the tragic first war with Chechnya. He let the so-called oligarchs, wealthy Russian businessmen, buy up Russian natural resources cheaply in 1996, in return for loans to his presidential campaign. He was erratic, often drunk, and made the autocratic Vladimir Putin his successor.

Yet I think Yeltsin will be remembered more for his huge achievements. He had a vision that the Soviet Union could be radically changed at a time when no one believed that. He instinctively wanted to give more power to the people. He never crushed his opponents, nor sent them to the gulag. He let a free press criticize him brutally, but never shut it down.

Had Yeltsin, as president of the Russian republic, not defied a coup attempt by hard-liners against Gorbachev in 1991, had he not famously rallied Muscovites while standing on a tank, Russia might have gone in a very different direction. How amazing that the Soviet system was deconstructed without purges or mass arrests.

And people tend to forget how real the chances seemed in 1993 that Russia might sink into nasty nationalism, or in 1996 that retrograde communists might retake power in elections. As a frequent visitor to Russia in the 1990s, I recall that nothing about the future seemed certain. Yeltsin's actions must be measured against the temper of those times.

Some will say that Yeltsin's mistakes begot the authoritarian Putin, who has recentered all power in the Kremlin and squashed the free press. I wonder whether any other leader could have presided over such tumultuous times without making big mistakes, or provoking a counterrevolution.

Had oil prices hit $70 per barrel in the 1990s, Yeltsin might have more easily been able to solidify democracy (as Putin has been able to buy off the Russian public while restoring autocracy). Instead, Yeltsin was cursed with prices of around $20 a barrel.

Yet he succeeded in putting Russia on a new path, and irrevocably destroying a decayed system. History will credit him with those towering achievements. There's scant question that, while I listened to him at Independence Hall, those revolutionary plans were germinating inside his brain.