Ghana will move a statue of Mahatma Gandhi from its main university because of his “alleged past racist comments”, the foreign ministry said, while paying tribute to Gandhi’s role as a civil rights leader.

A group of lecturers and students began campaigning for the Indian nationalist leader’s statue to be removed shortly after it was installed at the university in June as a symbol of friendship between Ghana and India. They argue that Gandhi made comments that were racist about Africans and that statues on the Accra campus should be of African heroes.

In a statement late on Thursday, the ministry said it was concerned by the acrimony the campaign had generated.

“The government would therefore want to relocate the statue from the University of Ghana to ensure its safety and to avoid the controversy … being a distraction (from) our strong ties of friendship,” it said.

Noting that Gandhi had inspired movements for civil rights and freedom across the world, the statement urged Ghanaians to “look beyond the comments attributed to … Gandhi and acknowledge his role as one of the most outstanding personalities of the last century.”

A senior Indian diplomat said the ministry’s “very good statement” had sought to set the life and work of the advocate of peaceful resistance in a broader context and that the statue would be moved from the university to a safer place.

Amar Sinha also told reporters in New Delhi the two governments had discussed the debate over Gandhi that had flared in Ghana and South Africa.

He said comments interpreted by some as racist had been made relatively early in the life of the Indian protest leader.

India’s struggle against British colonialism under Gandhi was an inspiration to a generation of African independence leaders, including Ghana’s Kwame Nkrumah, who in 1957 managed to persuade British authorities to grant Ghana independence – one of the first African nations to get it.

Gandhi lived in South Africa at the turn of the 20th century, where he campaigned for rights for the descendents of Indian indentured labourers brought there to work sugar plantations in its northeast Natal province, now KwaZulu-Natal.

Although his philosophy of peaceful protest would later inspire the African National Congress in its resistance to white Apartheid rule, historians say Gandhi himself was no believer in equality between races, at least not earlier in his career.

In his book, Gandhi: the True Man Behind Modern India, broadcaster Jad Adams quotes him as referring to black people as “kaffirs”, a deeply offensive term, in a speech in 1896:

“Ours is one continual struggle against a degradation sought to be inflicted upon us by the Europeans, who desire to degrade us to the level of the raw kaffir,” he quotes him as saying.

“And whose sole ambition is to collect a certain number of cattle to buy his wife with and then pass his life in indolence and nakedness.”

He later seems to have changed his views, saying stereotypes of Africans as “barbarians” are wrong, the author writes.