US President Barack Obama is visiting Tanzania this week, on his first trip as president to East Africa. The country is currently in the process of writing a new constitution, whose first draft proposes a three-tier government - which could lead to the island of Zanzibar seceding from the union with mainland Tanzania.
Extremism is on the rise in Tanzania, and hardline Islamist groups such as Uamsho - whose ideology is similar to the strict Wahhabi brand of Islam - have instilled fear among non-Muslims and Muslims alike. Uamsho has backing from many politicians in Zanzibar, an island in the Indian Ocean that is part of Tanzania but has its own parliament and president.
In this consitutional draft, the Tanzanian government has yielded to demands of powerful secession advocates in Zanzibar, making a split highly likely. This could be a huge blow to the war on terrorism in East Africa, as heavily armed groups could eventually make Zanzibar their power base.
Already there have been attacks in Tanzania, the most recent targeting a Catholic church in the northern town of Arusha in May. The attack left three people dead and was described by Jakaya Kikwete, the Tanzanian president, as an "act of terrorism". But the deadliest such assault occurred in August 1998, when 13 people were killed at the US embassy in Dar es Salaam.
Ordinary Tanzanians speculate that President Obama is positioning his country to benefit from the country's estimated 41.7 trillion cubic feet of recoverable natural gas reserves.
Although the number of attacks in Tanzania has been few compared to that in neighbouring Kenya - where the US embassy was targeted in 1998, leaving at least 200 people dead - they have caused sectarian divisions in a country largely seen as peaceful and stable by the US and its allies.
These divisions have never been seen in the country's 51 years of independence, and religion could become a key factor in the 2015 presidential election. Around half of Tanzanians are believed to be Christian, and around a third Muslim, although there are no official figures.
The terrorism threat aside, Obama is also visiting Tanzania months after China's new president, Xi Jinping, had finished a tour of the resource-rich country. As China continues to expand its footprint on the African continent, the United States is moving to strengthen ties with countries it has had good relations with over the years.
Tanzania is one such country, and despite what many say, relations between the United States and Tanzania have long been warm. President Kikwete visited Obama in 2009, shortly after the US president took office. Tanzania's first president, Julius Nyerere, visited the US during President John F Kennedy's administration in the early 1960s.
Ordinary Tanzanians speculate that President Obama is positioning his country to benefit from the country's estimated 41.7 trillion cubic feet of recoverable natural gas reserves. This speculation is stoked by the fact that US oil and gas exploration giant Exxon Mobil has already discovered a large natural gas deposit off the coast of Tanzania.
Tanzania's booming extractive industry makes it attractive to investors in many places. In countries such as the United States, Tanzania's biggest interest is in the private sector, which has capital and technology to develop the oil and gas industry. Although the US economy is still in the doldrums, Tanzania knows that its private sector has resources to invest abroad. But, most importantly, US investors go where their government prods them to go, and so might be looking to capitalise on the symbiotic relationship between the US government and its private sector.
The US government understands that there are political schisms and corruption in Tanzania, but the country's stability is important for US business interests and foreign policy, given the risk of terrorism on the coast of East Africa and the ongoing efforts to find peace in the Great Lakes region, as Tanzania shares borders with eight other countries.
Despite the corruption and likely instability in the future, President Obama's decision to visit Tanzania will be viewed by many as good judgment. The fact that Tanzania has held five successive democratic elections in a region plagued by political instability and tribal disputes does not only make it a good investment destination, but also gives it legitimacy and moral authority to broker peace in Somalia, where the United States is battling groups affiliated with al-Qaeda.
While Tanzania does not have troops in Somalia, unlike its northern neighbour Kenya, it is home to self-defined "Islamists" connected to armed groups in the region, including Somalia's al-Shabaab, according to United Nations experts.
Erick Kabendera is a Tanzanian freelance journalist. He contributes to The Economist Intelligence Unit (EIU) and Africa Confidential.
The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.