These must be difficult times for Osama bin Laden and his Egyptian deputy, Ayman al-Zawahiri. The uprising that swept away Hosni Mubarak after 18 days of huge demonstrations, none in the name of Islam, does not fit their ideology. In the war of ideas, al Qaeda suffered a major defeat.

Its leaders preach that the way to remove “apostate” rulers — and Mubarak was high on the list — is through violence. Al Qaeda’s ideology does not embrace the kind of people power that brought down the Berlin wall, forced Ferdinand Marcos of the Philippines into exile, and filled Cairo’s Tahrir Square with tens of thousands of peaceful protesters day after day.

They waved the red-white-and-black flags of Egypt, not the green banners of Islam, in peaceful demonstrations that amounted to “a huge defeat in a country of central importance to its image,” in the words of Noman Benotman, the former leader of a Libyan group often aligned with al Qaeda. “We are witnessing Osama bin Laden’s nightmare,” wrote Shibley Telhami, an Arab scholar at the University of Maryland.

Long before al Qaeda struck against what it calls “the far enemy” on Sept. 11, 2001, its leaders exhorted Arabs to take on the “near enemy” — Arab regimes that failed to run their countries under sharia law — with bloody attacks against its leaders and institutions. Violent jihad was the only way. First Tunisia, then Egypt, showed that the argument was flawed.

Which is probably the reason al Qaeda, an organization of considerable Internet savvy and communications skills, has been largely silent on the unrest that first flared in Tunisia, rolled over to Egypt and now keeps rulers awake at night from Algeria to Saudi Arabia, Syria and Bahrain.