JOHANNESBURG, South Africa - South African President Jacob Zuma and his African National Congress sought a court order Tuesday to have a painting depicting the president's genitals removed from an art gallery but two men took matters into their own hands by defacing the portrait with gobs of paint.

The case pits freedom of expression against the right to dignity, both guaranteed by South Africa's constitution. The painting by Brett Murray went on display in a Johannesburg gallery this month and came to the ANC's attention a week later, after local media reported it had been sold. Zuma, who has a reputation for promiscuity, took the depiction very personally and compared himself somewhat ironically to a rape victim. Zuma himself was put on trial for rape, and acquitted, in 2006.

"The portrayal has ridiculed and caused me humiliation and indignity," Zuma contended in an affidavit filed Tuesday with the South Gauteng High Court in Johannesburg.

Presiding over the hearing in a courtroom a few kilometres (miles) from the gallery, Judge Fayeeza Kathree-Setiloane said the full three-judge bench should hear the case because the national interest and constitutional issues are at stake. She said the hearing would recommence on Thursday.

Zuma and the ANC sought to have the painting, titled "The Spear," removed from the Goodman Gallery and to stop the newspaper City Press from displaying a photo of it on its website.

At about the time the hearing was under way, two men wielding cans of red and black paint calmly walked up to the painting hanging on a gallery wall and took turns defacing it.

"Now it's completely and utterly destroyed," said Iman Rappetti, a reporter for a South African TV channel who happened to be on the scene at the time as her camera rolled.

Her channel showed a man in a tweed jacket painting a red X over the president's genital area and then his face. Next, a man in a hoodie used his hand to smear black paint over the president's face and down the painting. The men were finally detained by gallery staff -- the second man was head-butted and thrown to the ground before he was handcuffed -- and police took them away.

Rappetti said she initially thought the first man was part of a performance art piece, and said staff at the gallery was slow to react.

The Goodman had said in a statement a day earlier that it was stepping up security, and gallery visitors said Tuesday their bags were searched as they went. After the vandalism the gallery was closed as a throng of reporters and onlookers gathered outside.

In a statement late Tuesday, the gallery said the painting had been moved to a safe and undisclosed place, and that the gallery would remain closed indefinitely.

"The painting has generated a debate that clearly engages with important legal and constitutional issues," gallery owner Liza Essers said in the statement. "This is over and above questions of political power, which formed part of its original dialogue.

"The extent of the rage has astonished me and upset me very much. I furthermore never imagined that this debate would transform into harmful physical action."

Murray, the artist, through the gallery, has refused to comment.

In a statement on the defacement, the ANC said it "cannot condone any action that is not legal." The party then inserted race into the debate by noting that the first man accused of defacing the painting, who is white, was arrested without incident, while the second man, who is black, was shown in a tussle with gallery guards. The ANC compared that to apartheid South Africa, when blacks were "treated differently from their white counterparts?"

Witnesses, though, said they did not at first understand what the first man was doing, and then he quietly moved aside and did not resist when gallery security detained him. The guards tried to stop the second man from defacing the painting, and he resisted, witnesses said.

Police said the two unidentified men, aged 58 and 25, are expected to appear in a magistrate's court on Thursday on a charge of malicious damage to property.

After the painting was defaced, a third man spray-painted the first three letters of the word "respect" on a wall near the gallery's front gate before he was taken away by police. He shouted that the gallery had shown the president disrespect.

Back at the courthouse, more than 100 pro-Zuma protesters gathered outside. Donavan Cloete held a black, green and gold ANC flag and wore a T-shirt with the slogan: "President Zuma has a right to human dignity and privacy."

"The artist has got his own views on the political situation. He has a right to express himself," Cloete said. "On the other hand, there's got to be a line drawn as to what constitutes satire and what constitutes insult."

But Sophia Morren, a ceramicist who was in the gallery with her daughter when the painting was defaced, said Zuma had shown little respect for himself. She referred to Zuma's six marriages -- he currently has four wives, his 21 children, and his acknowledgment in 2010 that he fathered a child that year with a woman who was not among his wives.

"He's famous for all his women, all his children. I get exactly what the artist is saying," Morren said. "Zuma shouldn't be complaining. Really."

She added she knew Murray had been celebrated for anti-apartheid art work in the past.

"Why is it good then and it is not good now?" she said of Murray's work. "You start proscribing to artists what they can and cannot paint, and then we are lost."

Zuma was acquitted of rape in May 2006 in the country's most politically charged trial since the end of apartheid. Trial testimony had raised questions about Zuma's attitude toward women and whether ultimately he had the judgment to govern. His testimony about having unprotected consensual sex with an HIV-positive AIDS activist demonstrated an amazing ignorance about HIV transmission by a man who once headed South Africa's campaign against the virus.

In his affidavit filed Tuesday, Zuma said he rejected suggestions that speaking out about the painting would "exacerbate the pain I am feeling about the image being publicized widely.

"This argument is similar to suggesting that, inter alia, victims of rape should not complain about the violations they have suffered because doing so will lead to publication of their ordeal. It is suggested therefore that such victims should keep quiet in order to limit public knowledge of their rights."

The painting is part of an exhibition of Murray's sculptures and paintings called "Hail to the Thief II." The ANC denounces the show as an "abuse of freedom of artistic expression."

The defaced painting is a black, red and yellow acrylic on canvas priced at 120,000 rand (about $15,000). In a style reminiscent of Andy Warhol's brightly colored Marilyn Monroe portraits, "The Spear" depicts Zuma in a suit, looking off into the distance.

The painting, priced at 120,000 rand (about $15,000), had been sold to an anonymous buyer before the defacement.