Millions of Kenyans are celebrating the long-awaited return of Barack Obama, who on Friday will visit his father's homeland for the first time as president to attend the 2015 Global Entrepreneurship Summit in Nairobi.

Obama's visit will focus on economic development and counterterrorism efforts within the country against the Somali Islamist group al Shabaab, but it comes amid widespread abuse by Kenyan security forces of Muslims, refugees, and journalists. This has raised worries among rights advocates that he risks lending undue legitimacy to one of Africa's more unscrupulous regimes. Similar concerns have been voiced about a presidential trip to Ethiopia that will follow.

Earlier this month, a group of 17 human rights organizations sent a letter to Obama urging him to address injustices in discussions with Kenyan President Uhuru Kenyatta.

"Recent government efforts indicate that President Kenyatta and his administration are undermining the new constitution and commitments to international human rights law, under the pretext of promoting national security and combatting terrorism," they said. "The US has a unique role in urging President Kenyatta and his government to change its current trajectory."

Obama is visiting a country whose human rights record has taken a notably downward turn. Following years of steady attacks from al Shabaab militants within Kenya, including an assault on Nairobi's Westgate shopping mall in 2013 that killed 67 and the massacre of 147 people at a university in Garissa earlier this year, local security forces are said to consistently engage in extrajudicial activity in the name of fighting terrorism, and are accused of harassing journalists and undermining press freedoms.

A vendor in Nairobi prepares to sell T-shirts printed with pictures and welcoming messages for US President Barack Obama ahead of his visit to the country. (Photo by Daniel Irungu/EPA)

There have been reports of Kenyan authorities rounding up Muslims from Nairobi's ethnic Somali neighborhood, demanding bribes and often detaining people without charge until friends or family members can collect enough money. Leslie Lefkow, deputy Africa director for Human Rights Watch (HRW), has described Muslims and Somalis in Kenya as doubly victimized by al Shabaab and security forces "who routinely mete out collective punishment."

The tactic risks radicalizing young Muslims who are alienated by the government.

"Terrorism is proliferating because of its own actions," Farah Maalim, former deputy speaker of Kenya's National Assembly and a Muslim who has been called to testify before anti-terrorism police, told VICE News. "Instead of arresting high-profile targets, they do extrajudicial killings."

Abuses by Kenya's security forces are well documented. Between November 2012 and January 2013, Kenyan police "tortured, raped, and otherwise abused and arbitrarily detained at least 1,000 refugees," according to HRW. Last year the organization documented at least 10 cases of extrajudicial police killings and another 10 forced disappearances of suspected terrorists. Members of Kenya's anti-terrorism police unit later admitted to Al Jazeera that their superiors directed them to assassinate nearly 500 terror suspects in flagrant disregard for Kenyan and international law.

'He is legitimizing the leadership in Nairobi. The signal is clear.'

Some argue that the US is implicated in these crimes. The FBI has trained more than 800 members of the country's security personnel in counterterrorism, and the US government devoted $19 million to fund Kenyan counterterrorism in 2012 alone.

Meanwhile, Kenya's security forces have been unable to prevent other terrorist attacks, as al Shabaab regularly raids Kenya's coast. The group killed 29 people in two such assaults earlier this month. In March, the governor of Kenya's northern Mandera County called the situation "extremely hopeless."

"In once sense, what happened at Westgate was a big failure for the US because they spent so much on intelligence training," Stig Jarle Hansen, a Norwegian expert on East African security, told VICE News. "The US has a lot of interest in having a strong Kenya, but there are several structural issues with the Kenya anti-terrorism forces that they need to address. One is corruption, and another is lack of attention to human rights and the tendency to use extrajudicial killings and collective punishment as a strategy."

Munyori Buku, a spokesperson for the presidency, dismissed allegations of abuse.

"There have been no human rights violations by the security forces," he told VICE News. "Not of Kenyan citizens, not of Somali citizens. [The government] is clearly dealing with one specific thing: terror."

A Kenyan man walks past a cardboard cutout of Barack Obama at the entrance of a restaurant in Nairobi. (Photo by Daniel Irungu/EPA)

Government intimidation extends to the press. After journalists reported that Kenyan soldiers looted the Westgate mall during the crisis, the government imposed a code of conduct penalizing journalists for such vague crimes as not "sticking to the issues." The government also enacted a security law last year that required journalists to get permission to report on anti-terror operations and publish images of terrorist attacks. (In February, Kenya's high court ruled that various sections of the law were unconstitutional).

"What we've seen is repeated attempts by the authorities to silence the press on themes of security," Tom Rhodes, east Africa representative for the Committee to Protect Journalists, told VICE News. CPJ documented 16 cases of Kenyan officials threatening or attacking journalists between this past January and May. "When you talk to local journalists on the ground, they say they used to pitch certain stories freely, but these days editors will scrap a story for fear of retribution."

'Those who suffered in Westgate, in Garissa, they would not feel very good about his criticism of the government over human rights.'

For Kenya's leaders, Obama's visit seems to offer a momentary reprieve from criticism by civil society groups. When he declined to visit Kenya on his three previous tours of Africa as president, Kenyans criticized what they saw as a political snub against his ancestral homeland.

When Obama declined to visit Kenya on his third trip to Africa, in 2013, many of the country's citizens criticized what they saw as a political snub against his ancestral homeland. The International Criminal Court (ICC) had charged Kenyatta, who had just been elected president, with crimes against humanity. He was accused of inciting ethnic violence following the December 2007 reelection of then-President Mwai Kibaki, which was widely seen as fraudulent.

Kenyatta allegedly instigated revenge violence against opposition tribe members who had clashed with Kikuyus, Kenya's majority ethnic group, of which Kenyatta and Kibaki are members. Charges against Kenyatta included providing weapons and funding to Kikuyu gangs in order for them to murder, rape, and displace ethnic minorities from their homes in Nakuru and Naivasha in central Kenya.

"Everybody understood that for [Obama] to come by and shake hands with someone charged with crimes against humanity by the International Criminal Court would have been a real black mark on the United States," Maina Kiai, a UN Special Rapporteur on human rights and a lead investigator in the case, told VICE News.

The case stalled, however, and ICC prosecutors announced in December that they would abandon the charges against Kenyatta. (William Ruto, his deputy president, still stands accused of similar crimes.)

Kenya's president said he felt "vindicated" after being libeled by a "defective process."

A Kenyan man photographs cakes on display in Nairobi that are decorated with portraits of Barack Obama. (Photo by Daniel Irungu/EPA)

"This was a manufactured case based on bribes and botched evidence," Kenyatta's spokesperson Buku said. "The ICC lied to Kenyatta, lied to the people of Kenya, and lied to themselves."

Various observers have suggested that Kenyatta got off because he and his allies intimidated witnesses for the prosecution, some of whom eventually withdrew their claims and declined to testify against him. Kenyatta denies this.

In Kenya, only a handful of people have been convicted of major crimes committed during the violence, including roughly 1,200 deaths and the displacement of some 600,000 people from their homes.

"We know people were killed in Naivasha. We do know that women were raped, we do know that men were forcefully circumcised," said Kiai. "People who support Kenyatta would rather forget and move on."

Some see Obama's visit as an implicit endorsement of this sentiment.

"In a sense, he's accepting the verdict of the International Criminal Court despite his personal feelings," Edward Kisiangani, a prominent political analyst and professor at Kenyatta University in Nairobi, told VICE News. "He is legitimizing the leadership in Nairobi. The signal is clear."

Hansen, the East African security expert, agreed.

"Symbolically this is very important for Kenyatta," he said. "It demonstrates he's a part of the international community again."

Obama's visit is not only a symbolic strengthening of ties, but a tangible one. His administration last year hosted 51 African heads of state to Washington for a major summit that led to pledges of $33 billion to help Africans improve agricultural production, expand electricity access, and spur business development, among other initiatives.

"The fact that 51 African heads of state were invited to the White House signaled that Africa was a priority for the US," Witney Schneidman, policy fellow at the Washington-based Brookings Institute, told VICE News. "And it signaled that where we had differences with African governments, we were going to address those differences and we were not going to hold them at arms length because of those differences."

Nevertheless, Kisiangani suggested that Obama should avoid certain subjects.

"If Obama comes speaking on human rights, he's likely to receive a cold reception, especially from Christians who think their friends have been killed — maimed by people fighting for Islam," he said. "Those who suffered in Westgate, in Garissa, they would not feel very good about his criticism of the government over human rights."

Another topic that many say is off-limits: gay rights. Kenyan lawmakers recently warned Obama not to raise the issue on his visit, with one asserting that he should be ejected from parliament if he does so. Despite the enthusiasm for Obama's visit, various anti-gay protests are expected to greet his arrival, including the planned demonstration of a massive crowd of naked people to "show him the difference between men and women."

Notwithstanding a new constitution drafted in 2010 that outlaws discrimination and protects individual privacy, Kenya's penal code continues to criminalize homosexuality, with "acts of gross indecency" and "against the order of nature" bringing sentences of up to 14 years imprisonment.

"This country is heavily Christian. This homosexuality is something people are not familiar with," said Buku. "It is not a concern. Homosexuality is not on the agenda."