South Africa’s highest court has ruled that husbands can take the surname of their wives, overturning a law that barred them from doing so.

In a victory for two couples who brought the case, the Constitutional Court ruled that the law was a “colonial import” that amounted to gender-based discrimination.

Henry van der Merwe was denied the right to take the surname of his wife Jana Jordaan, while Andreas Nicolas Bornman could not hyphenate his surname to include Donnelly, the surname of his wife, Jess Donnelly-Bornman, the public broadcaster, SABC, reports.

Parliament will now have to amend the Births and Deaths Registration Act, along with its regulations, for the ruling to take effect.

The law was introduced in South Africa during the years of white-minority rule.

Two couples had argued that the law was archaic and patriarchal, and violated equality rights enshrined in the constitution that South Africa adopted at the end of apartheid in 1994.

They successfully challenged the law in a lower court, but asked the Constitutional Court to confirm its ruling.

The Constitutional Court noted that “in many African cultures, women retained their birth names after marriage, and children often took their mother’s clan name” but this changed after the “arrival of the European colonisers and Christian missionaries, and the imposition of Western values”.

“The custom that a wife takes the husband’s surname existed in Roman-Dutch law, and in this way was introduced into South African common law.

“This custom also came into existence as a result of legislation that was introduced by countries that colonised African countries south of the Sahara,” the court said.

It added that South Africa had made a “significant advancement” in gender equality, but some laws and practices that perpetuated “harmful stereotypes” still remained in place.

Neither the Minister of Home Affairs, Leon Schreiber nor the Minister of Justice and Constitutional Development Mamoloko Kubayi opposed the two couples’ application, instead agreeing that the law was outdated.

A legal body, the Free State Society of Advocates, joined the court case in support of the two couples.

It argued that by restricting a man’s right to assume their wife’s surname, the law perpetuated harmful stereotypes, as it denied men a choice available to women, the Sowetan news site reports.

BBC