NAIROBI, Kenya — With the attack on the Westgate Mall in Nairobi, Somalia’s Al Qaeda-aligned Al Shabaab militants have elevated themselves from dangerous national insurgency to transnational terrorist threat.

The driving force behind the change is Al Shabaab leader Ahmed Godane, aka Abu Zubeyr, who this year has led an internal purge and assumed total control of the organization.

Described by one observer as “a hardcore jihadi,” Godane was born in the breakaway region of Somaliland in 1977, a member of the Isaaq clan which dominates in the north but is in the minority in the rest of the country.

According to Stig Jarle Hansen, a Norwegian academic and author of the book "Al-Shabaab in Somalia," Godane went to school in Hargeisa and later won scholarships to study in Sudan and later Pakistan. It is thought he travelled from there to Afghanistan, where he may have received military training.

The young man who went on to become one of the most wanted terrorists on the planet grew up a quiet, pious poetry lover. “Godane led a very devout life,” said Rashid Abdi, an independent analyst and expert on Somalia’s Islamic militants. “He had a quiet charisma, never smiling, a no-nonsense guy who spent most of his time alone writing poetry.”

In Somalia poetry is used to rally people to political causes and even rebellion, most famously by Mohamed Abduallah Hassan, dubbed "The Mad Mullah" by the British colonialists against whom he fought in the early 20th century.

Abdi said that Godane places himself in this tradition of the Somali warrior poet, “mobilizing Somali clans against outside forces.” In his speeches he employs the cadence and flourishes of traditional Somali poetry. “He has the power to draw young people,” said Abdi.

In an audio message released days after the Nairobi attack, Godane praised the Westgate terrorists who killed at least 67 people, including women and children, during the four-day-long siege. “I have been sent ahead of the hour with the sword so that Allah will be worshipped alone without partners,” he said.

Speaking in a Somali-language recording shared via Twitter and posted on several websites, Godane congratulated the attackers and sought to justify their bloody acts as retaliation for the presence of Kenyan soldiers in Somalia as part of an African Union peacekeeping mission (AMISOM).

“The attack at Westgate Mall was to torment the Kenyan leaders who’ve impulsively invaded [Somalia]. It was also a retribution against the Western states that supported the Kenyan invasion and are spilling the blood of innocent Muslims in order to pave the way for their mineral companies,” Godane said.

There is no doubt that Godane now holds both operational and organizational control of Al Shabaab and its perhaps 5,000 fighters, including dozens of Westerners.

The attack on Nairobi’s Westgate mall was a statement of intent, a warning and a threat to Kenya. Toward the end of his Westgate audio message Godane spoke directly to the Kenyan people.

“There is no way that you could possibly endure a prolonged war in Somalia and you cannot also withstand a war of attrition inside your own country,” he said.

“So make your choice today and withdraw all your forces,” Godane said. Otherwise, he warned, “an abundance of blood will be spilt in your country.”

Godane was first linked to terrorism in October 2003. He joined the local franchise of militant group Al Ittihad Al Islamiya (AIAI) and was accused of involvement in the murder of a British couple, Dick and Enid Eyeington, who ran a school in Somaliland.

After that he moved south to Mogadishu and rose through the ranks of Al Shabaab, the armed wing of the Islamic Courts Union, a grassroots movement that controlled the country for part of 2006. When the US backed Ethiopia’s invasion of Somalia to oust the Islamic Courts, it was Al Shabaab that positioned itself as the nationalist, Muslim resistance to a foreign, Christian assault.

By 2008 Godane had become Al Shabaab’s "emir," succeeding Aden Hashi Ayro, who was killed in a US missile strike that year. Godane sought to move Al Shabaab closer to Al Qaeda but Osama Bin Laden declined the offer of a formal alliance, according to documents found in his Abbottabad residence. He also warned Godane to govern well and to be careful not to harm Muslims in his attacks.

Survivors of the Westgate attack said the gunmen separated Muslims and non-Muslims, releasing the former and executing the latter.

After Bin Laden’s death, Godane was accepted into Al Qaeda’s fold and in 2012 pledged allegiance. The US offered a $7 million reward for information leading to his capture.

Under Godane’s leadership, Al Shabaab ventured outside Somalia’s borders for the first time, with suicide bombings in Kampala, Uganda in 2010 that killed 74 people.

Al Shabaab also came to control almost all of southern Somalia and the capital Mogadishu. But in the last two years it has suffered a string of military defeats by AMISOM and has been riven by internal disputes.

The tensions became public in April this year when a group of senior Shabaab fighters wrote a letter to Al Qaeda leader Ayman Al-Zawahiri criticizing Godane’s autocratic leadership style. “[Godane] takes decisions in a secret fashion without legitimate known reasons,” they wrote.

In response, Godane carried out a bloody purge, leaving him in undisputed control of the organization. Among those assassinated was the American jihadi Omar Hammami and Ibrahim Al-Afghani, a friend, one-time mentor and co-founder of Al Shabaab. Like Godane, he was also a member of the Isaaq clan.

“Killing Al-Afghani, his own clansman, indicates how determined he is,” said Abdi.

According to a report by the United Nations Monitoring Group on Somalia, there is a “special clandestine division” within Al Shabaab called the Amniyat, a secret service loyal only to Godane comprising various autonomous cells for intelligence gathering, fund-raising, assassinations and suicide attacks.

The Amniyat is “an organization within an organization … most likely intended to survive Al Shabaab,” said the report published in July.