The attacks in Burkina Faso that left 28 people dead and 55 injured point to an increasing security challenge in West Africa, where, analysts say, militant groups affiliated to Al-Qaeda and Islamic State are taking advantage of fragile and weak states to hit western targets.

This is the second time in a couple of months that militants launched an assaulted directed at an establishment popular with foreigners. In neighboring Mali last November, in a similar fashion to what happened at the Splendid Hotel in Ouagadougou, gunmen stormed the Radisson Hotel in Bamako and took 170 people hostage and ultimately killing 21 people many of whom westerners.

In both of these cases, the militant group Al-Qaeda in the Islamic Maghreb (AQIM) claimed responsibility.

AQIM, which traces its roots to the Algerian civil conflict in the 1990s and became an al-Qaeda affiliate in mid-2000s, has increasingly focused their strategies on targets located in countries that are either weak or unstable. In west Africa, it has targeted Algeria, Niger, Mali killing people and carrying out kidnappings for ransom, all done with the objective of ridding the region of what they perceive to be the corrupting influence of the West.

In 2012, the group launched one of its most audacious operations helping to orchestrate the takeover of northern Mali and imposed its version of Sharia law in the area. While the territory was eventually taken back into government control with the help of a French intervention, the event showcased how dangerous AQIM could be.

Their ability to operate with some success is helped considerably by a lack of strong governing institutions in countries in the region, United States’ top commander in the region has said. “The network of al-Qa’ida and its affiliates and adherents continues to exploit Africa’s under-governed regions and porous borders to train and conduct attacks,” Gen. David M. Rodriguez, the head of the United States Africa Command (AFRICOM), told the U.S. Senate Armed Services Committee last year.

The power vacuum in Libya that followed the fall of Muammar Gaddafi has allowed militant groups, including AQIM, to acquire weaponry that they are now employing to devastating effect against targets in the region. On top of that, they are using the country as a lunching pad for their missions.

“Libya appears to be emerging as a safe haven where terrorists, including al-Qa’ida and Islamic State of Iraq and the Levant-affiliated groups, can train and rebuild with impunity,” Rodriguez told Senators.

With Libya as a base, AQIM has exploited instability in the region to conduct their attacks. Burkina Faso is a case in point. The country has no history of terrorism but over the last two years Burkinabes have endured tremendous political turmoil. A toppling of a long-term ruler in 2014 was followed by an interim government that was overthrown last September only to be reinstated a few days later. The newly elected government of Roch Marc Christian Kaboré has only been in power for less than a month. This kind of uncertainty is ideal breeding ground for militants like AQIM, analysts say.

“Weak government and chaos are always conducive to terrorism,” Hans-Jakob Schindler, a coordinator of a United Nations Security Council committee that monitors al-Qaeda, told the New York Times. “These groups do take advantage of that.”