The plan, hatched for months in the arid mountains of North Africa, was to attack the American and British Embassies here. It ended in a series of gun battles in January that killed a dozen militants and left two Tunisian security officers dead.

But the most disturbing aspect of the violence in this normally placid, tourist-friendly nation is that it came from across the border in Algeria, where an Islamic terrorist organization has vowed to unite radical Islamic groups across North Africa.

Counterterrorism officials on three continents say the trouble in Tunisia is the latest evidence that a brutal Algerian group with a long history of violence is acting on its promise: to organize extremists across North Africa and join the remnants of Al Qaeda into a new international force for jihad.

[Last week, the group claimed responsibility for seven nearly simultaneous bombings that destroyed police stations in towns east of Algiers, the Algerian capital, killing six people.]

This article was prepared from interviews with American government and military officials, French counterterrorism officials, Italian counterterrorism prosecutors, Algerian terrorism experts, Tunisian government officials and a Tunisian attorney working with Islamists charged with terrorist activities.

They say North Africa, with its vast, thinly governed stretches of mountain and desert, could become an Afghanistan-like terrorist hinterland within easy striking distance of Europe. That is all the more alarming because of the deep roots that North African communities have in Europe and the ease of travel between the regions. For the United States, the threat is also real because of visa-free travel to American cities for most European passport holders.

The violent Algerian group the Salafist Group for Preaching and Combat, known by its French initials G.S.P.C., has for several years been under American watch.

“The G.S.P.C. has become a regional terrorist organization, recruiting and operating in all of your countries — and beyond,” Henry A. Crumpton, then the United States ambassador at large for counterterrorism, said at a counterterrorism conference in Algiers last year. “It is forging links with terrorist groups in Morocco, Nigeria, Mauritania, Tunisia and elsewhere.”

Officials say the group is funneling North African fighters to Iraq, but is also turning militants back toward their home countries.

The ambitions of the group are particularly troubling to counterterrorism officials on the watch for the re-emergence of networks that were largely interrupted in the wake of the Sept. 11, 2001, attacks. While most estimates put the current membership of the group in the hundreds, it has survived more than a decade of Algerian government attempts to eradicate it. It is now the best-organized and -financed terrorist group in the region.

Last year, on the fifth anniversary of the Sept. 11 attacks, Al Qaeda chose the G.S.P.C. as its representative in North Africa. In January, the group reciprocated by switching its name to Al Qaeda of the Islamic Maghreb, claiming that the Qaeda leader, Osama bin Laden, had ordered the change.

“Al Qaeda’s aim is for the G.S.P.C. to become a regional force, not solely an Algerian one,” said the French counterterrorism magistrate, Jean-Louis Bruguière, in Paris. He calls the Algerian group the biggest terrorist threat facing France today.

“We know from cases that we’re working on that the G.S.P.C.’s mission is now to recruit people in Morocco and Tunisia, train them and send them back to their countries of origin or Europe to mount attacks,” he said.

The G.S.P.C. was created in 1998 as an offshoot of the Armed Islamic Group, which along with other Islamist guerrilla forces fought a brutal decade-long civil war after the Algerian military canceled elections in early 1992 because an Islamist party was poised to win.

In 2003, a G.S.P.C. leader in southern Algeria kidnapped 32 European tourists, some of whom were released for a ransom of 5 million euros (about $6.5 million at current exchange rates), paid by Germany.

Officials say the leader, Amari Saifi, bought weapons and recruited fighters before the United States military helped corner and catch him in 2004. He is now serving a life sentence in Algeria.

Change of Leadership

Since then, an even more radical leader, Abdelmalek Droukdel, has taken over the group. The Algerian military says he cut his teeth in the 1990s as a member of the Armed Islamic Group’s feared Ahoual or “horror” company, blamed for some of the most gruesome massacres of Algeria’s civil war.

He announced his arrival with a truck bomb at the country’s most important electrical production facility in June 2004, and focused on associating the group with Al Qaeda.

Links to the G.S.P.C. soon began appearing in terrorism cases elsewhere in North Africa and in Europe.

In 2005, Moroccan authorities arrested a man named Anour Majrar, and told Italy and France that he and two other militants had visited G.S.P.C. leaders in Algeria earlier that year.

His interrogation led to arrests in Algeria, Italy and France, where Mr. Majrar’s associates were quickly linked to an attempted robbery of 5 million euros at an armored car depot in Beauvais, north of Paris. A hole had been blown in a wall at the depot with military-grade C4 plastic explosives, but it was not big enough for the men to get through.

A later investigation turned up Kalashnikov assault rifles, French Famas military assault rifles, rocket-propelled grenades, TNT and two more pounds of C4. French counterterrorism officials say the group was planning attacks on the Paris Metro, the city’s Orly Airport, and the headquarters of the Direction de la Surveillance du Territoire, France’s domestic intelligence agency.

Italian prosecutors say a related cell in Milan was planning attacks on the city’s police headquarters and on the Basilica of San Petronio in Bologna, whose 15th-century fresco depicts the Prophet Muhammad in hell.

The G.S.P.C. or its members in Algeria appear to have become a touchstone for groups suspected of being terror cells across the region, in much the way that Qaeda representatives in London were a decade ago.

Wiretaps, interrogation of terrorism suspects and recovered documents suggest that the network has associates in France, Italy, Turkey and even Greece, which is favored as an entry point to Europe because of its relatively lax immigration controls, counterterrorism officials say.

There had been hints that the North African groups were planning more formal cooperation as far back as 2005, when Moroccan intelligence authorities found messages sent by Islamic militants to Osama bin Laden, according to European counterintelligence officials.

Evidence of an Alliance

Indications that a cross-border alliance was under way came in June 2005, when the G.S.P.C. attacked a military outpost in Mauritania, killing 15 soldiers. The attackers fled into Mali, according to the United States military.

Moroccan police officers raiding suspected Islamic militant cells last summer also found documents discussing a union between the G.S.P.C. and the Islamic Combatant Group in Morocco, the Islamic Fighting Group in Libya and several smaller Tunisian groups, intelligence officials say.

In September, Al Qaeda’s second in command, Ayman al-Zawahri, released a videotape in which he said that his global terrorist network had joined forces with the G.S.P.C.

The video was followed by an unsettling increase in terrorist attacks across the region, including one against Halliburton employees in Algeria in December that left one Algerian dead and nine people wounded.

But the strongest evidence yet of the G.S.P.C.’s North African cross-border cooperation came in January when Tunisia announced that it had killed 12 Islamic extremists and captured 15 of them. Officials said that six of the extremists had crossed into the country from Algeria.

Their 36-year-old leader, Lassad Sassi, was a former Tunisian policeman who ran a terrorist cell in Milan until May 2001 before fleeing to Algeria, according to an Italian prosecutor, Armando Spataro.

Mr. Sassi, now dead, is still listed as a defendant in a current terrorism trial in Milan, which began before he died. He was charged in absentia with providing military clothing and money to the G.S.P.C. while financing and planning suicide bomb attacks in Italy.

Tunisian officials say that Mr. Sassi and five other men — four Tunisians and one Mauritanian — crossed the rugged border from Algeria into Tunisia months ago.

They set up a base in the mountains of Djebel Terif, where Mr. Sassi trained 20 other Tunisian men in the use of automatic weapons and explosives.

A Trail of Violence

The decision to move against the group began when the police in the Tunis suburb of Hammam Lif detained a young woman in December who led them to a house where a gun battle left two suspected terrorists dead, two officers wounded and two other men in custody, a police officer involved said. His account of the events could not be independently verified.

Another arrest led the police into the hills toward the training camp.

Three of the militants and a Tunisian Army captain were killed during a chase through the mountains. Tunisian security forces mounted a search in which 13 more men were arrested and Mr. Sassi was killed.

The remnants of the group fled and members were later tracked down and killed in another gun battle.

Tunisian officials have sought to play down the G.S.P.C. link, and have said the recently dismantled group’s target was the West.

In fact, according to Samir Ben Amor, a Tunisian attorney who defends many young Tunisian Islamists, more than 600 young Tunisian Islamists have been arrested in the past two years — more than 100 in the past two months — trying to make their way to Iraq to fight the United States.

“It’s the same thing that we saw in Bosnia, Kosovo and above all Afghanistan,” said Mr. Bruguière, the French magistrate. “Al Qaeda’s objective is to create an operational link between the groups in Iraq and the G.S.P.C.”

Tunisia is among the most vulnerable of the North African countries, because its rigid repression of Islam has created a well of resentment among religious youth, and its popularity as a tourist destination for Europeans makes it a target.

Tunisian security forces found Google Earth satellite images of the American and British Embassies as well as the names of diplomats who worked in both buildings. But according to the police officer involved in the case and journalists in Tunisia, the targets also included hotels and nightclubs.

An attack on those sites would have dealt a heavy blow to Tunisia’s tourist industry, one of the country’s most important sources of foreign exchange. An April 2002 bombing of a synagogue on the Tunisian tourist island of Djerba, for which the G.S.P.C. claimed responsibility, helped sink the country’s economic growth that year to its slowest rate in a decade.

Copyright 2007 The New York Times Company