LAGOS, Nigeria — In a rare high-level visit to Africa's most populous country, U.S. Secretary of State John Kerry on Sunday urged Nigeria's leading presidential candidates to refrain from fomenting violence after next month's vote, and he condemned savage attacks by Boko Haram, an al-Qaida-linked insurgency.
On a day when Nigerian troops battled extremists who attacked Maiduguri, the biggest city in the northeast, Kerry played down reports that the U.S. had grown frustrated with Nigeria's military commitment to fighting the radical Islamist movement.
Kerry said the U.S. was sharing intelligence with Nigeria and stood ready to do more if the Feb. 14 election proceeded in a nonviolent, democratic fashion.
"The United States is deeply engaged with Nigeria," he said. "Does it always work as well as we would like or as well as the Nigerians would like? The answer is no."
Kerry was in the country's commercial capital, Lagos, about 1,000 miles southwest from the skirmishes that killed more than 200 combatants.
Independent analysts have condemned the government's tactics against Boko Haram, arguing that they inspire support for a movement driven by joblessness, alienation, ethnic divisions and poor governance.
Speaking at the U.S. consulate's residence overlooking the Gulf of Guinea, Kerry told reporters that America and others will closely watch the election in this country of 170 million people.
"This will be the largest democratic election on the continent," Kerry said. "Given the stakes, it's absolutely critical that these elections be conducted peacefully — that they are credible, transparent and accountable."
Kerry spoke after meeting in separate locations with both leading candidates, President Goodluck Jonathan and Muhammadu Buhari, the former military dictator whom Jonathan defeated in 2011. More than 800 people were killed in northern protests after Buhari, a Muslim northerner, lost to Jonathan, a Christian from the south.
Both candidates pledged to tamp down on violence, Kerry said, but the secretary also issued a warning: Anyone who incites postelection mayhem will be ineligible to enter the United States.
On terrorism, Kerry said he was concerned about the Islamic State group making inroads in Africa, but said he saw no direct link between those Syria- and Iraq-based militants and Boko Haram.
In a report last week, the Virginia-based Center for Naval Analyses, a federally funded research corporation, called Boko Haram a locally focused insurgency largely fueled by bad government.
"The conflict is being sustained by masses of unemployed youth who are susceptible to Boko Haram recruitment, an alienated and frightened northern population that refuses to cooperate with state security forces, and a governance vacuum that has allowed the emergence of militant sanctuaries in the northeast," the report said.
"The conflict is also being perpetuated by the Nigerian government, which has employed a heavy-handed, overwhelmingly (military) approach to dealing with the group and has paid little attention to the underlying contextual realities and root causes of the conflict," the report said. That view comports with the assessment of the U.S. intelligence agencies.
In December, Nigeria canceled the last stage of U.S. training of a Nigerian army battalion, a reflection of strained counterterrorism relations between the two governments.
In April 2014, Boko Haram kidnapped 270 schoolgirls from the northern town of Chibok, prompting international condemnation and a campaign to "Bring Back Our Girls." Most of the girls, however, have not been rescued.
Boko Haram has denounced democracy and is fighting to impose its strict version of Shariah law.