A controversial painting of South African president Jacob Zuma with his genitals hanging out has been vandalised.

A protester painted a red X on the face of the painting before a second man masked the mid-section of the painting with black paint.

Staff at theGoodman Gallery in Johannesburg confirmed the painting called "The Spear" had been defaced.

"The work has been painted over with black and red paint," a spokesman said.

South African local news reports suggest the two men were a lecturer and one of his students.

"I'm doing this because the painting is disrespectful to President Zuma," one of the men told the BBC.

Both men were detained by the gallery's security staff while awaiting police.

The 1.85m-high painting is part of Cape Town artist Brett Murray's Hail to the Thief II exhibition at the Goodman Gallery.

The attack came as the governing African National Congress went to the South Gauteng High Court in Johannesburg to have the painting removed from the gallery.

The ANC had sent the gallery a lawyer's letter asking it to remove the painting. The Gallery refused to take down the painting until the exhibition was over.

"These court papers are seeking to interdict both parties from displaying and exhibiting on their website or any other platform including the online channels, the offensive and distasteful so-called portrait," ANC spokesperson Jackson Mthembu said.

A full bench of the High Court was set to hear the case on 24 May.

It is not yet clear whether this case will proceed now that the painting has been defaced.