Palestinian protesters have whitewashed a rainbow flag painted on six slabs of the West Bank separation barrier. Khaled Jarrar, the Palestinian painter of the piece, said his art was meant as a reminder of Israeli occupation, at a time when gay rights are in the news after the US allowed same-sex marriage.

But protesters perceived the painting as support for homosexuality, a taboo subject in Palestinian society where gay people are not tolerated. It ignited angry responses and activists whitewashed the flag on Monday night, just a few hours after it was painted on the best-known section of Israel’s graffiti-covered barrier, next to a portrait of Yasser Arafat and other Palestinian figures.

Repainted section of barrier in the West Bank city of Ramallah on Tuesday. Photograph: Nasser Shiyoukhi/AP

Jarrar, 39, who has exhibited his work in Europe and the US, told the Associated Press on Tuesday that the destruction “reflects the absence of tolerance and freedoms in the Palestinian society”.

“People don’t accept different thinking in our society,” he said, adding he painted the rainbow flag on the barrier to put a spotlight on Palestinian issues.

Muhammad, who only gave his first name for fear of repercussions, said he helped whitewash the flag because “we cannot promote gay rights”.

Muhammad al-Amleh, a 46-year-old lawyer, approved of the action, saying “it would be shameful to have the flag of gays in our refugee camp”.

Gay Palestinians tend to be secretive about their social lives and some have crossed into Israel to live safely. There are no laws on the books in either the West Bank or the Gaza Strip that specifically ban homosexual acts.

Israel, meanwhile, has emerged as one of the world’s most gay-friendly travel destinations, in sharp contrast to the rest of the Middle East where gay people are often persecuted and even killed. Earlier this month, more than 100,000 people attended a gay pride parade in Tel Aviv.

Officially there is still no same-sex marriage in Israel, primarily because there is no civil marriage of any kind – all Jewish weddings must be conducted through the rabbinate, which considers homosexuality a sin and a violation of Jewish law. But the state recognises same-sex couples who marry abroad.

Same-sex relations are punishable by death in Iran, Mauritania, Saudi Arabia, Sudan and Yemen.

• This article was amended on 13 August 2015 after AP issued this correction: “The Associated Press reported erroneously that homosexual acts are banned by law in the West Bank and Gaza Strip. While homosexuality is largely taboo in Palestinian society, there are no laws specifically banning homosexual acts.”