In recent weeks, the Tunisian, Jordanian, and Lebanese parliaments have repealed provisions in their penal codes that allowed rapists to escape punishment by marrying their victims. Provisions like these, largely colonial-era relics, remain on the books in many other countries in the region and beyond. Some permit exoneration for a range of offences, including kidnapping, rape, and sex with a child (statutory rape) if the perpetrator marries the victim.

On July 26, the Tunisian parliament repealed article 227bis in full when it passed its landmark law on eliminating violence against women. Less than a week later, on August 1, the lower house of Jordan's parliament approved the full repeal of article 308. Jordan's penal code amendment still has to go to the appointed upper house for approval and requires the king's signature to become law. On August 16, Lebanon's parliament repealed article 522, that had allowed rapists to escape prosecution by marrying the victim, but allowed a loophole in offences relating to sex with children between the ages 15-17 and seducing a virgin girl into having sex with the promise of marriage.

A colonial legacy

These reforms are credit to the intense campaigning by women's rights non-governmental organisations in these countries. But, most people are unaware of the colonial origin of such laws in the Middle East and North Africa region. They largely stem from or were inspired by the French Napoleonic Code of 1810, which allowed a man who kidnapped a girl to escape prosecution if he married her. The Ottoman Code of 1911 introduced a similar article inspired by the French. France only repealed this provision in 1994.

READ MORE: Scrapping of Lebanon rape law 'is one small step'

Former French colonies and mandates particularly in North Africa and parts of the Middle East kept the rape exoneration provisions in some form in their laws after independence or took inspiration from the French Code when drafting their own penal codes. Former British mandates and protectorates applied the Ottoman Code with rape exoneration while under British rule, and retained it after independence.

In the Middle East and North Africa region, Algeria, Bahrain, Iraq, Kuwait, Libya, Syria, and Palestine still allow rapists to escape punishment.

Patriarchal attitudes and stigma kept such provisions in place. In many countries, people considered rape survivors "unmarriageable". Some legislators even felt that the laws protected women and girls from being killed by their family members for having sex outside of marriage. Their "solution" led to impunity for rapists but trapped women and girls in unwanted, abusive marriages. It also allowed child marriage in countries that had otherwise set a minimum age of marriage at 18.

Tunisia, Lebanon, and soon Jordan, join others in the region that have rooted out such provisions. In January 2014, Morocco's parliament removed a clause from article 475 of its penal code that had, in effect, allowed some men who raped a child to escape prosecution if they married the victim. In 1999, Egypt repealed article 291 from its penal code, which had allowed rapists or kidnappers to escape prosecution by marrying their victims.

Holding on to outdated laws

The bad news is that many countries still have these outdated, abusive laws. In the Middle East and North Africa region, Algeria, Bahrain, Iraq, Kuwait, Libya, Syria, and Palestine still allow rapists to escape punishment.

Bahrain's parliament proposed a full repeal of article 353 in 2016. But the cabinet rejected the proposal, and parliament is now considering a narrower repeal in which the exemption will not be allowed in cases of gang rape.

Globally, several Latin American countries, the Philippines, and Tajikistan are among countries that retain such laws. But, in the past 30 years, a number of countries have made similar reforms, including Costa Rica (2007), Uruguay (2006), Ethiopia (2005), Romania (2000), Peru (1998), and Italy (1981), among others.

Laws alone can't change practices. Indeed, forced marriages to rapists may have existed before such marriage exonerations were codified. Even if such provisions are removed, forced marriage may continue unofficially as it has in many countries. The authorities should, once exoneration laws are removed, take steps to change the discriminatory attitudes and stigma that fuel forced marriages of rape survivors to their rapists.

In the Middle East and North Africa, this means promoting respect for women's physical integrity and autonomy and shifting away from traditional views about the family's "honour" being tied to women's and girls' behaviour, including maintaining their virginity before marriage. Authorities should also ensure that rape survivors, and girls and women at risk of so-called "honour" violence at the hands of their families, are provided with assistance and protection.

The recent reforms in Tunisia, Jordan, and Lebanon could propel reforms in the region and beyond, but only if other countries take heed. Rape-marriage exoneration laws are a relic of the colonial past. It's time to leave them there.

Rothna Begum is the women's rights researcher for the Middle East and North Africa region at Human Rights Watch. During this time, she has led the research on violence and discrimination against women in the MENA region, and the abuse and exploitation of migrant domestic workers in the Gulf. Rothna previously worked for Amnesty International for five and a half years' researching human rights violations in the Gulf region. Rothna holds a LLB in Law and a LLM in Legal Theory from the London School Economics and Political Science.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.