French Socialist Party national secretary Harlem Desir meets with Niger's president Mahamadou Issoufou, left, on March 17 in Niamey. (HAMA BOUREIMA/AFP/GETTY IMAGES)

NIAMEY, Niger — As the Obama administration expands its counterterrorism operations in Africa, this country is rapidly emerging as a key U.S. partner.

President Mahamadou Issoufou was elected in a free and fair vote two years ago and wins praise in Washington as a model democrat. But on a wall of the presidential palace in the capital of Niamey, framed photos of his predecessors — a succession of glum-faced military dictators and deposed civilians — illustrate the West African country’s volatile history since it won independence from France in 1960.

With chaos enveloping Mali to the west and militant groups holding sway in Libya to the north, Issoufou frets about a possible spillover of violence into Niger. But, in an interview, he said those preoccupations would not cause his country to backslide on human rights or good governance. He also pointed to the benefits of cooperation with the U.S. military, which he invited to base surveillance drones here.

“Today, everyone agrees with the links between security, democracy and development,” he said, speaking in French and dressed in white tribal regalia. “For the short term, the solution is military, but for the long term it is development.”

The Pentagon is deepening its military involvement across Africa as it confronts an expanding array of terrorist movements and guerrilla groups. In doing so, the U.S. government has become dependent on several countries with checkered democratic records. That in turn has lessened Washington’s leverage to push those countries to practice free elections and the rule of law.

In Djibouti, on the Horn of Africa, President Ismail Omar Guelleh has ruled unchallenged over his tiny country since 1999 by marginalizing political opponents and confining journalists. Still, the U.S. government has embraced Guelleh as a friend because he has allowed the Pentagon to build a major counter-terrorism base on his territory.

In Uganda, where Yoweri Museveni has served as president for 27 years, U.S. officials have objected to the persecution of gay men and lesbians and other human-rights abuses. But Washington has kept up a generous flow of foreign aid. It also pays Uganda to send troops to war-torn Somalia and lead a regional hunt for Joseph Kony, the brutal leader of the Lord’s Resistance Army.

In Kenya, U.S. diplomats warned there would be unspecified “consequences” if the country elected a fugitive from the International Criminal Court as its new president. Kenyans did so anyway, and the Obama administration has hesitated to downgrade relations because it needs help on counter-terrorism.

Human-rights groups have also accused the U.S. government of holding its tongue about political repression in Ethiopia, another key security partner in East Africa.

“The countries that cooperate with us get at least a free pass,” acknowledged a senior U.S. official who specializes in Africa but spoke on condition of anonymity to avoid retribution. “Whereas other countries that don’t cooperate, we ream them as best we can.”

The official said the administration of former president George W. Bush took the same approach in Africa. Many U.S. diplomats and human-rights groups had hoped Obama would shift his emphasis in Africa from security to democracy, but that has not happened, the official added.

“There’s pretty much been no change at all,” the official said. “In the end, it was an almost seamless transition from Bush to Obama.”

Johnnie Carson, the State Department’s top official on African affairs during Obama’s first term, disputed that and said the United States had not toned down its pro-democracy message.

“The dialogue about democracy in each of those countries is rich and dynamic,” he said just before his retirement last month. “These security relationships do not provide an excuse for us not to engage fully with the leaders of all of these countries on the very fundamental principles that are at the heart of our policy: strengthening democratic institutions.”

In North and West Africa, the U.S. military has bolstered cooperation in recent years with several countries in an attempt to defuse threats from Islamist fighters allied with al-Qaeda. But political instability has been a stumbling block.

In Mauritania, the U.S. government was compelled by U.S. law to suspend military and counter-terrorism aid twice, because of coups in 2005 and 2008. Washington was forced to do the same thing in Niger after its coup in 2010 and in Mali last year, when a Malian army captain who had received extensive training in the United States overthrew a democratically elected leader.

Washington resumed counter-terrorism aid to Mauritania and Niger after those countries subsequently held elections. The Obama administration is eager to patch up relations with Mali as well so it can take a more direct role in combating al-Qaeda forces in the northern half of the country; U.S. officials are pushing for national elections in July.

Gregory Mann, a Columbia University historian who studies West Africa, said the U.S. government was risking prolonged instability in Mali by encouraging a vote before the country is ready. Mali’s central government is still weak, with little control over much of its territory.

“Rapid elections lead to instability,” Mann said. “I’d rather have a slow election than 10 years of post-election uncertainty.”

Niger gets good marks from outside groups for freedom of the press and a multi-party political system. But ethnic tensions, chronic food shortages and a bloated public sector make the Saharan country “notoriously unstable,” said Sebastian Elischer, a specialist on Niger at the German Institute of Global and Area Studies.

He said Issoufou was “probably a convinced democrat” but added that the president’s hold on power was hardly guaranteed. “He does represent hope and a new beginning, but the question is, does he have the resources to see it through.”

Marou Amadou, Niger’s justice minister and a former democracy activist, said the government’s commitment to good governance would not be eclipsed by security concerns.

“I want to make one thing clear: Do not confuse security with dictatorship. Security is for everybody. Security reinforces democracy,” he said. “I don’t see less of an emphasis on human rights.”

But Moussa Tchangari, the general secretary of Alternative Citizen Space, an activist group in the capital, said the government’s close ties with the U.S. and French militaries would allow it to resist domestic calls for reform.

“There is a need for change in our country, but our government doesn’t want to do what is necessary,” he said. “Having a foreign military presence protects them.”