The Egged transit company, its ad agency Canaan, and the state signed an agreement Wednesday to allow pictures of women on its bus advertisements in Jerusalem and Beit Shemesh, wrapping up a High Court petition that lasted two years.

As part of the deal, the state agreed to provide compensation for any acts of vandalism the ads would incur, according to the Ynet news site. In recent years, Egged refrained from placing women in its advertisements in these cities amid concerns the images would offend, or draw protest from, its sizable ultra-Orthodox clientele.

In August 2012, the Yerushalmim (Jerusalemites) activist group, now a political party, submitted a petition to the High Court, which soon after ruled the bus company could not bar women from its ads.

The Yerushalmim group subsequently launched an ad campaign in the capital to underline the victory. The new ads showed four smiling women, with the slogan: “Women of Jerusalem, nice to meet you.” And in small print: “Because Jerusalem is for everyone.”

But, the Yerushalmim claimed, the Canaan ad agency had covered up the bare arms of the women in the photos, spurring them to pull the campaign.

In response, Egged withdrew all photos of people — male and female — from its bus ads to comply with the court order, which led the Yerushalmim to petition again to the High Court. The transit company also pulled a psychometric exam ad campaign in June 2013 featuring an extra-terrestrial, fearing it was insensitive to the ultra-Orthodox population.

The Yerushalmim activists maintained that the decision not to run advertisements depicting people was merely a front to continue barring the visual representation of women on the buses.

Following the newly signed deal on Wednesday, both parties are expected to ask the High Court to withdraw the petition.

Professor Aviad HaCohen, who represented the Yerushalmim group, hailed the decision and said that “at the end of the day common sense prevailed, and the obvious was accepted without the need for court intervention. The public sphere in Israel in general, and Jerusalem in particular, belongs to everyone, and it is forbidden to exclude women [from the public sphere].”

Times of Israel staff contributed to this report.