The leaders of the Islamic State, also known as ISIS, have been actively coordinating with loyalists in Libya since at least the start of 2015, sending personnel back from Syria to help them establish their fledgling colony. Their Libyan province, headquartered in the port city of Surt, grew to become their most important outside of Iraq and Syria.

After nearly two years, the Libyan branch recently lost ground, with its forces routed from more than 100 miles of coastline. But no one believes the group has been destroyed there — instead it has dispersed, while maintaining its operational abilities.

The Battar brigade was formed by Libyan fighters who were seasoned veterans of Iraq and Afghanistan. It was among the first foreign jihadist contingent to arrive in Syria in 2012, as the country’s popular revolt was sliding into a broader civil war and Islamist insurgency, said Cameron Colquhoun, formerly a senior counterterrorism analyst at Britain’s Government Communications Headquarters, or GCHQ, its surveillance and intelligence agency.

“One of the things I remember from my time is the fact that some of the baddest dudes in Al Qaeda were Libyan,” he said, citing a study of seized Qaeda personnel files by the Combating Terrorism Center at West Point, showing that as far back as 2007, almost 20 percent of the terrorist group’s fighters in Iraq were from Libya.

“When I looked at the Islamic State, the same thing was happening,” said Mr. Colquhoun, who now runs Neon Century, a corporate intelligence consultancy in London. “They were the most hard-core, the most violent — the ones always willing to go to extremes when others were not. The Libyans represented the elite troops, and clearly ISIS capitalized on this.”

Soon, the Battar brigade’s battlefield reputation began attracting newcomers, especially from a pipeline of recruits sent by Sharia4Belgium, a group in Brussels that lured numerous Belgian as well as French men to the cause. One was the son of a Moroccan shopkeeper who had moved to Belgium, Abdelhamid Abaaoud, the future commander of the Paris attacks. Units like Battar al-Libi became the Islamic State’s shock troops, specializing in the use of assault rifles and suicide belts or vests as they overrun positions. They fight as long as they can, then aim to set off their explosives at some critical spot or when they cannot go on, as happened at the Bataclan concert hall in Paris.

Mr. Colquhoun believes that it was inside the Battar brigade that Mr. Abaaoud was introduced to the techniques he later unleashed on civilians in Paris.