After years of promoting jihad in online forums, Muadh Irshad was ready to take his fervor to the real world.

"I spent beautiful years tasting hope and pain in these forums ... Today it is time for farewell," he wrote in his final post. "Jihad is the solution."

Two weeks later, on Sept. 23, Moroccan security forces raided his Casablanca apartment, allegedly finding plans to attack Jewish businessmen, French journalists and police stations. He was arrested with two accomplices. Soon afterward, a second raid in Casablanca netted another cell plotting attacks.

The two cells reflect a form of terrorism that experts say is one of the greatest dangers facing the world today: Freelance jihadism.

Morocco's vigilant internal security forces and tightly guarded borders have kept al-Qaida at bay in this North African kingdom, which attracts millions of tourists worldwide. But it hasn't stopped the lone wolves who are inspired by al-Qaida to carry out copycat attacks. As post-9/11 surveillance routinely busts up organized cells and terror networks, these self-styled jihadis are gaining more prominence around the globe.

Lone-wolf plots in Europe and the United States are increasingly the focus of international anti-terror operations. In March, a Kosovo Albanian acting alone fatally shot two American airmen in Frankfurt, Germany. And a former U.S. Army psychiatrist is the sole suspect in deadly shootings at Fort Hood, Texas in 2009.

In the Middle East, small homegrown cells have been cropping up in countries like Morocco and Egypt that don't have a strong al-Qaida presence.

In some ways Morocco's single cells are less daunting to fight than the coherent al-Qaida network in neighboring Algeria and Mauritania, an implacable, well-armed and well-funded enemy with a strategic agenda. For the most part, the amateur jihadi outfits are nipped in the bud, like the ones over the last two weeks.

However, just as in plots in the West, it can be hard to pick up on lone jihadis in tiny cells that are not part of an organization. On April 28, for example, a remote control bomb exploded in a Marrakech cafe popular with tourists, killing 17 people, mostly foreigners.

Moroccan authorities have pinned that attack on Adel al-Othmani, who was inspired by al-Qaida and tried unsuccessfully for years to join the international terror network before returning to Morocco to devise an attack of his own. Al-Qaida is known to be fairly suspicious about people wanting to join, partly because of the potential for entrapment by authorities.

"The links with al-Qaida, with terrorism in Algeria, are always done by individuals," Moroccan Communication Minister Khaled Naciri told The Associated Press. He acknowledged that al-Qaida may be attempting to gain entry, saying that for Algeria-based al-Qaida in North Africa, or AQIM, "it's normal to try to gain a foothold in every country in North Africa, including Morocco."

Al-Qaida in the Islamic Maghreb has vowed to attack all over North Africa, including Morocco. In 2003, 33 people were killed in a string of suicide bombings in Casablanca by an al-Qaida linked Moroccan group, the same one blamed for the deadly Madrid transit attacks in March 2004.

Under heavy pressure, the group was soon afterward dismantled.

Since then, AQIM has been unable to penetrate the kingdom's borders, thanks to the country's decades-old battle with an independence movement in the Western Sahara and strong internal security.

Morocco's main vulnerability could be the long-running dispute over the Western Sahara, where anger and frustration among youth in a territory annexed by Morocco in 1975 could prove fertile breeding ground for extremism.

AQIM grew out of Algeria's civil war when a faction that long fought army generals _ who mounted a coup 20 years ago to stop an Islamist election victory _ announced its allegiance to the international terror network in 2006 and proclaimed region-wide ambitions.

Since then AQIM has kept up a steady drumbeat of attacks in Algeria, while expanding its presence in the Sahara Desert and the lightly patrolled frontiers of Mali, Niger and Mauritania, where it has embedded itself into the traditional smuggling trade.

But in Morocco the picture has been one of scattershot independent plots.

In 2010, four cells planning to attack foreign targets were dismantled around Morocco, according to the U.S. State Department's annual report on terrorism. Between 2003 and 2008 alone, Moroccan government figures reported 83 of these small cells being broken up.

On Oct. 1 and on Sept. 23, two small groups were arrested for allegedly planning attacks, also against foreign interests. A student was then arrested on Oct. 5, allegedly with plans to plant bombs under the cars of government officials. Security officials say these groups had al-Qaida links through the Internet and extremist websites, but were not formally part of the group.

The discussion rooms of militant websites provide a glimpse at the seething rage found across much of the Muslim world as would-be mujahedeen trade tips on how to strike blows against the "Crusaders and Zionists," especially if they are unable to make it to the battlefields of Iraq and Afghanistan on their own.

On Sept. 20, someone issued an open call for "lone wolf" attacks in Morocco, sparking a discussion that included suggestions of setting fire to police stations, bombing tourist resorts or even targeting Western ships in the Straits of Gibraltar, the narrow passage that separates Morocco from Spain.

Irshad, the head of the cell arrested on Sept. 23, was an active online participant in these discussions and in 2008 posted his own handbook for young mujahedeen interested in carrying out operations at home, recommending they undertake physical fitness programs and form two- to three-man cells.

Mohammed Darif, an expert on political Islam and extremist movements, cautions against putting too much weight in the virtual world of extremism. It is too easy for security services to pose as wannabe jihadists online, he explained.

"When we talk about people consulting these sites, we can talk about a virtual link, but that doesn't mean it's material," he said. "Even al-Qaida doesn't trust these virtual links."

The pattern in Morocco is for these groups to reach out to AQIM or another branch for weapons or instruction _ not always successfully _ rather than al-Qaida itself making the first move.

"It is not al-Qaida that is looking to set itself up in Morocco, what we have is Moroccans looking to join the ranks of al-Qaida, there is a big difference," he said.

Morocco's southern desert flank and the dispute over the Western Sahara could prove decisive.

Morocco annexed the former colony in 1975 and spent the next 25 years battling the Polisario independence movement until a 1991 ceasefire resulted in an uneasy truce. Negotiations for some kind of solution, however, have stalled over the last 20 years.

Polisario is backed by Algeria's government, the primary enemy of AQIM, making it doubtful the two movements would cooperate _ but al-Qaida could still take advantage of the widespread disaffection in the sprawling desert territory.

"Whenever you have a pool of young men with nothing else to do and poor prospects, you have a heightened risk _ all the more so when the young men in question have had military training as those in the Polisario camps have," said Peter Pham, director of the Africa center at the Atlantic Council think tank.

AQIM did use a former Polisario militant to kidnap Spanish aid workers in 2009 and in January of this year, Moroccan authorities dismantled a militant cell in the Western Sahara that Moroccan authorities said had links to al-Qaida.

Moroccan authorities, however, also have a history of exaggerating terrorist threats for domestic or international consumption.

In 2008, a Belgian-Moroccan man was arrested for planning attacks against local Jews and foreign interests. The net was soon spread wide to include a 32-person network featuring everyone from Western Saharan activists to moderate Islamist politicians, prompting a great deal of skepticism in the country.

At the time, a State Department cable later exposed by WikiLeaks commented that "we do not know enough to rule out the possibility that a real but more limited network has been blown into a red herring."