Turkey has abandoned plans for a controversial law that would have allowed men who had sex with underage children to be pardoned if they married the victim.

The reversal came after Parliament approved the bill in an initial reading on Thursday, with a final vote scheduled for Tuesday. However, Prime Minister Binali Yildirim said the government had pulled the highly controversial measure from the parliament floor and would submit it for a review by an all-party committee.

Justice Minister Bekir Bozdag then said later on Tuesday that the government had shelved the proposal and it would come back on the agenda in the future only if all parties could reach a consensus. Mr Bozdag added: “The issue has been closed.”

The plans provoked fury in the country and saw thousands take to the streets on Saturday in protest.

Turkey’s government had insisted the law would help resolve the legal challenges caused by widespread child marriage in the country, but critics said the bill legitimised rape.

The law would have allowed men who sexually abused girls under 18 without “force, threat or any restriction on consent” and then married them, to have their convictions quashed or avoid prosecution.

The change would have applied to cases between 2005 and 16 November 2016.

The latest bill – proposed by the ruling Justice and Development Party (AKP) – came after Turkey’s constitutional court annulled part of the criminal code in July which classified all sexual acts with children under 15 as sexual abuse, a change that also prompted uproar.

Although the legal age of consent is 18 in Turkey, child marriage is widespread, particularly in the South-east.  The country has one of the highest rates of child marriage in Europe, with an estimated 15 per cent of girls married before their 18th birthday.

Hundreds of people gathered in front of the parliament building to protest against the measure burst into celebrations after the government decision.

Opposition parties, rights groups and citizens had widely condemned the proposal since its initiation last week, issuing statements and staging demonstrations across cities nationwide.

United Nations agencies, including the children’s fund Unicef, issued a joint statement on Monday warning that the proposal “would weaken the country’s ability to combat sexual abuse and child marriages”.

The government had insisted it was committed to fighting child marriages but said the measure was needed to help 3,800 families where underage marriages had occurred according to customs.

“We cannot ignore this [problem],” Mr Yildirim said. “There are 3,800 cases and thousands of children. The children are paying the price of their parents’ mistakes.”

In 2005, the government scrapped loopholes in legislation that had allowed men to escape rape charges if they married the victim, as part of efforts to join the European Union.

Associated Press contributed to this report