A Tanzanian court has upheld a ruling banning the marriage of girls under the age of 18 and won praise from rights activists.

The High Court in 2016 ruled that laws allowing girls as young as 15 to be married with the permission of their parents, or even 14 with the permission of a court, were unconstitutional and discriminatory.

However, the state had appealed.

"We reject this appeal as it has no foundation," the appeals court judges wrote in their ruling on Wednesday, giving the government one year to amend the law.

In an initial ruling the court found the current law discriminatory, as the legal age for men to marry is 18, and said it was contradictory that a girl considered too young to vote would be allowed to marry.

"It is a great day for Tanzanian girls," the NGO Wasichana Initiative, which fights for the rights of young girls, wrote on Twitter.

"It is a joyful day for all girls and all those who want what is best for them," said Anna Henga of Tanzania's main rights group, the Legal and Human Rights Centre (LHRC).

On average, two out of five Tanzanian girls are married before their 18th birthday, according to government statistics.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.