“Faced with crisis, the man of character falls back on himself. He imposes his own stamp of action, takes responsibility for it, makes it his own.” So said Charles de Gaulle, who knew a thing or two about handling crises.

We have just been through a crisis triggered by an article in Rolling Stone that led to a change of command in Afghanistan. And what the crisis reveals about the character of the three principals — President Obama, Gen. Stanley McChrystal and Gen. David Petraeus — has been largely positive to a degree I would not have expected when this blow-up occurred.

Obama has been looking increasingly embattled because of his failure to stop the oil spill, to cope with the Iranian nuclear program and other pressing issues. But he emerged from this test looking crisp and decisive — in a word, presidential.

He did not allow the Rolling Stone flap to become a drawn-out drama as he did with the review of Afghanistan policy in the fall. He decided that McChrystal had to go, and within a day he was out. Obama was especially shrewd to replace him with Petraeus, the best general we have, thus ensuring minimal disruption in operations. This was an unorthodox move, and Obama gets credit for making it.

In the process, the president ignored advice from some pundits to use this occasion to conduct yet another review of the war. Instead he strongly affirmed his support for the strategy laid out last December, notwithstanding all the carping about how the counterinsurgency approach has already failed at a time when it’s barely been tried. A Republican friend on Capitol Hill summed it up well in an email: “This was the best we’ve seen Obama on the war. Wish we don’t have to wait six months for him to speak on the war. POTUS picking Gen. P. is clear indication that he is going with COIN [counterinsurgency] and not Biden. This is a good sign for the December review.”

I already had an extremely high opinion of Petraeus before this event; I am hard put to think of anyone in public life that I admire more. But he has actually gone up in my estimation because he has agreed to take a demotion from being head of U.S. Central Command, the regional military command for the entire Middle East. He will go from being McChrystal’s boss to his replacement. There is little precedent for such a move, and many other officers would have hesitated before accepting, especially since this will entail another long stretch away from home.

That’s a considerable sacrifice considering that Petraeus has been deployed almost nonstop since 2001-2002 when he was a lowly brigadier general in Bosnia. He then served three tours in Iraq and since 2008 has been on the road constantly as the Central Command chief.

It is hard to imagine any personal gain to be had from this latest assignment; Petraeus is already the most successful and best-known officer of his generation, and he risks tarnishing his reputation as a miracle worker if he cannot turn around Afghanistan as he did Iraq. A career counselor would no doubt advise him to pass up this job and let some other general risk failure. But he unhesitatingly stepped into the breach. Why? I assume it’s because he knows that prevailing in Afghanistan is a vital national interest, he believes that a good outcome is possible, if difficult, and he feels a duty to serve when called upon.

Finally, how does McChrystal come out? The Rolling Stone interview obviously diminished his stellar reputation — and it should. Griping to any reporter is stupid; griping on the record to an antiwar reporter is stupidity squared. Moreover, the comments made by McChrystal and his staff revealed a disturbing contempt for civilian authority and a lack of basic decorum.

But if the actions that led up to the crisis tarnish McChrystal, the way he handled his downfall calls for respect. To use an old-fashioned, politically incorrect term, McChrystal “manned up.” He did not try to blame his staff. He did not claim he was misquoted or that the Rolling Stone reporter violated a confidentiality agreement. He apologized for a terrible blunder and offered his resignation. Reportedly in the Oval Office meeting with Obama, he made no effort to keep his job. As Sen. John Kerry said: “He was very respectful and apologetic, and I think, obviously understood he’d made a mistake and he wasn’t making any excuses. He was being pretty direct and upfront.”

That’s a welcome contrast from civilian officeholders such as former President Bill Clinton whose first instinct is self-preservation. McChrystal’s dignified departure — and the way it was handled by all concerned — diminishes the harm that could have come from this unfortunate incident.

Max Boot is the Jeane J. Kirkpatrick Senior Fellow in National Security Studies at the Council on Foreign Relations. He is writing a history of guerrilla warfare and terrorism.