WARSAW (Reuters) - The lesbian parents of a Polish boy have been given the right to register him in Poland as their child, a high court has decided, in an unprecedented ruling for the deeply Catholic country where same-sex marriage is illegal.

The case first came before a local administration in 2015 when a Polish woman requested to register her son, who was born in London in 2014, for a Polish birth certificate, the daily newspaper Rzeczpospolita said.

The Polish woman and her female partner were registered as the child’s parents in Britain, but local administrators in Poland rejected the woman’s request.

An official of the Supreme Administrative Court on Thursday confirmed to Reuters that the court had now ruled in favor of the gay couple. A written statement would be issued later on Thursday.

Polish media said the ruling was the first of its kind in Poland, where gay marriage is illegal and gay people have fewer rights than in many other European countries.

Poland ranks second last out of 28 EU countries when it comes to equality and non-discrimination, according to Rainbow Europe, an organization linked to the International Lesbian, Gay, Bisexual, Trans and Intersex Association.

“This ruling will open up new legal possibilities for gay parents ... It civilizes and increases the safety of families who choose to live partially in Poland and partially abroad,” said Pawel Knut, a lawyer for Polish gay rights organization, the Campaign Against Homophobia.

Poland’s ruling nationalist Law and Justice (PiS) party, which consists of many lawmakers who oppose gay marriage, declined a request for comment. The Polish Bishops’ Conference, which represents Poland’s Catholic Church, said it was working on a comment.

Church attendance is declining among Poland’s 38 million people, along with the clergy’s influence among policymakers, but it remains one of Europe’s most religious countries.