ATHENS (Reuters) - Greece approved legislation on Wednesday speeding up child adoption and allowing same-sex couples to become guardians of orphans, cutting a morass of bureaucracy where candidate parents and thousands of children are trapped waiting for years.

There is an average six-year waiting time for prospective parents to go through the adoption process, a key deterrent for thousands of people. The new process limits waiting time to 8-12 months, although many cases will be subject to court approval.

“This regime of grief comes to an end today,” Labor Minister Effie Achtsioglou told parliament.

The law, which also sets up a registry of minors under adoption and candidate parents, was approved by a majority of lawmakers in the 300-seat parliament, after a heated debate.

A provision allowing same-sex couples in a civil partnership agreement to become guardians of parentless children led to protests from the Orthodox Church and unrest in Prime Minister Alexis Tsipras’s left-right coalition.

Most of the lawmakers in his right-wing ally’s Independent Greeks party, rejected the article, with one lawmaker saying that it was “absurd” during the debate. Two of his Syriza party lawmakers also voted against the article.

Tsipras said attention should be shifted to “the state’s stance towards the children who are deprived of a normal life and grow up in institutions, children that in the eyes of the state have been invisible, one would say children of a lesser God.”

He said that the state currently cannot determine the exact number of orphans. One leftist lawmaker put the number of children living in care centers at about 3,000.

According to data from the Greek statistics agency cited in the bill, adoptions in the country fell to 216 in 2016 from 563 in 2012. More than a quarter of a million children are adopted each year worldwide.

Adoption by single sex couples is allowed in at least 12 European Union member states including France, Portugal and Spain, according to a 2016 European parliament paper.