The U.S. has spoken out against Tanzania’s moves to cut back on human rights and civil liberties, particularly arrests and harassment of LGBTQ people.

“The United States government is deeply concerned over escalating attacks and legislative actions by the Government of Tanzania that violate civil liberties and human rights, creating an atmosphere of violence, intimidation, and discrimination,” the U.S. Department of State said in a statement posted Friday.

"We are troubled by the continued arrests and harassment of marginalized persons, including lesbian, gay, bisexual and transgender people and others who seek to exercise their rights to freedom of speech, association and assembly,” the statement continued.

FILE PHOTO: Tanzanian President John Magufuli in Kenya on Oct. 31, 2016. Thomas Mukoya / Reuters

Tanzanian President John Magufuli's government, which came into power in 2015, has been criticized by opposition politicians and international rights groups for what they say is growing authoritarianism and intolerance of dissent. The government rejects the criticism.

The U.S. Embassy in Tanzania earlier this month warned its citizens in the East African country to be cautious after the commercial capital Dar es Salaam announced a crackdown on homosexuality.

“Review internet footprint and social media profiles,” the security alert stated. “Remove or protect images and language that may run afoul of Tanzanian laws regarding homosexual practices and explicit sexual activity.”

The alert said any American citizen detained or arrested in Tanzania should ensure local officials have alerted the U.S. Embassy of the arrest, which is required by the Vienna Convention on Consular Relations.

Homosexuality is punishable in Tanzania by a prison sentence of 30 years to life, one of the harshest punishments in the world for same-sex intimacy, according to Human Rights Watch.

The European Union last week recalled its envoy in Tanzania and said it would review its relations with the country in response to the anti-gay crackdown.

“The E.U. regrets the deterioration of the human rights and rule of law situation in Tanzania and will be conducting a broad review of its relations with Tanzania,” spokeswoman Susanne Mbise said in a statement.

The statement issued by the U.S. State Department on Friday said the “deteriorating state of human rights and rule of law” in Tanzania “inhibits development, economic prosperity, peace, and security,” and called on the country to take appropriate action.

“We call on Tanzanian authorities to act decisively to safeguard the rights of civil society organizations, human rights defenders, journalists, health workers, political activists, and all people in accordance with the Tanzanian constitution, the African Charter on Human and People’s Rights, and the country’s international and regional obligations and commitments,” the statement concluded.

FOLLOW NBC OUT ON TWITTER, FACEBOOK AND INSTAGRAM