“The appropriate word to describe their reactions to the president’s comments is fury,” he said, “notwithstanding the fact that the president has said that he didn’t say what was attributed to him. They don’t believe it.”

Mr. Brigety said that Mr. Trump’s remarks were on the agenda for the annual African Union summit meeting in Addis Ababa, Ethiopia, this month.

“A red line has been crossed,” he said.

Ottilia Anna Maunganidze, a researcher at the Institute for Security Studies in Pretoria, said the protests from Botswana and from the African Union reflected a deep undercurrent of frustration and anger. “Strong statements from other African countries show that the continental body won’t just put up with Trump’s views,” she said.

The United States has many interests in Africa: battling Islamist insurgencies like Boko Haram in West Africa and the Shabab in the Horn of Africa; reducing political instability and improving governance, particularly in conflict-torn nations like South Sudan and Somalia; and taking advantage of the dynamism of a rapidly urbanizing continent that is rich in natural resources and has a young and growing population.

“Obviously we have been competing with the Chinese for engagement and influence in Africa,” Mr. Brigety said. “It is an understatement to say that the president’s remarks do not help in this regard. To have insulted an entire continent in the most vile terms is manifestly harmful to our interests.”

Patrick Gaspard, the United States ambassador to South Africa from 2013 to 2016, said that progress on trade, public health, security and education, among many areas, had been “thrown into question by the irresponsible and vulgar comments made by the president.”