The aftermath of an attack by al-Shabab to a restaurant in Mogadishu, Somalia on June 15, 2017. Getty Images

An overnight siege of a restaurant in Mogadishu, Somalia, carried out by the Islamic extremist group al-Shabab left at least 31 people dead and nearly 40 wounded on Thursday morning, according to a report by the Associated Press.

All five attackers were killed after their attempt against Pizza House, a restaurant that is reportedly popular with young Somalis. The gunmen impersonated military forces and detonated a car bomb at the gate to begin the attack, police and a witness said.

Read: Terrorism In Africa: Al-Shabab Under Attack In Somalia Amid Killing Claim

Shortly after the attack began, al-Shabab took responsibility for it via a statement to Radio Andalus, a broadcast system that supports the militant group. On Thursday morning, the attack ended when soldiers surrounded the building, neutralized the situation and killed all five attackers.

“I never thought I would have the chance to see the sun again,” university student Saida Hussein told the Associated Press. “They were killing people on sight.”

Al-Shabab, which translate to "The Youth" in Arabic, is an Al-Qaeda-linked group that has been active since 2006 but has recently emerged as the deadliest Islamic extremist group in Africa. It claimed more than 4,200 lives in 2016, according to the Washington-based Africa Center for Strategic Studies, and is estimated to have between 7,000 and 9,000 members.

It has promised to escalate the extremity of its attacks after Somalia’s new government revamped its offense system against it.

On Sunday, the U.S. military in Africa said it executed an airstrike in southern Somalia that killed eight Islamic extremists. Somalia’s President Mohamed Abdullahi Mohamed corroborated this information and said these measures would help damage al-Shabab’s ability to coordinate new attacks.

The attack on Pizza House comes after a U.S. Navy SEAL was killed by al-Shabab in May. According to an al-Shabab spokesman, the May attack was in retaliation for a U.S. attack on one of its bases.

It was the first U.S. combat death in Somalia since the 1993 “Black Hawk Down” incident, which brought down two helicopters and killed 18 American soldiers.

U.S. military intervention in Somalia ended after the Black Hawk Down incident.

In March, President Donald Trump approved new operations, including, but not limited to, airstrikes against the extremist group.

Read: Where Is ISIS? Islamic State Kills Somalia Spy In Mogadishu: Report