Pop star Katy Perry will get her chance to live in a former Roman Catholic convent after a judge on Wednesday invalidated the property's sale to a restaurateur.

The months-long real estate dispute in Los Angeles has involved a group of nuns, the Archdiocese and a former convent in the style of a Roman villa. Attorneys for Perry said in a statement that they were pleased with the ruling, and that it cleared the way Perry to buy the property.

RELATED: Can Oscar Isaac change the fate of Hamlet?

The case had pitted Perry, the daughter of Protestant pastors and one of the top-selling pop stars in the world, and the archdiocese against the Sisters of the Immaculate Heart of Mary. The nuns once lived in the convent and wanted to sell it to Los Angeles restaurateur Dana Hollister.

Representatives for the nuns and Hollister did not reply to requests for comment.

Michael Hennigan, the attorney for the archdiocese, said that Los Angeles Superior Court Judge Stephanie Bowick had approved the archdiocese's motion to block the sale to Hollister in its entirety.

Perry, who rose to fame with the hit song "I Kissed a Girl," offered to buy the eight-acre property for $14.5 million to use as her private residence.

RELATED: A real love story came out of "Game of Thrones"

The nuns had rebuffed the 31-year-old performer, accepting a competing $15.5 million bid from Hollister, who wanted to convert the former convent into a hotel.

The archdiocese filed a lawsuit last June asserting that it had the final say over disposition of the property for the nuns' benefit.