She first tried to enter the choir in 2016 but was denied. Two years later, she again sought entry and was informed in a letter signed by the dean of the music department, “Never will a girl sing in a boys’ choir.”

In March, the choir invited the girl to sing before a selection committee, but the choirmaster, Kai-Uwe Jirka, judged the girl to not be good enough. The choirmaster said she lacked the “high level of motivation” and “extraordinary talent” necessary to participate in the ensemble, the university said in a statement released by the court.

The university further said that the girl’s voice did not “fit the sound sought after for a boys’ choir.” The university did not respond to a request for comment.

After three hours of arguments, the five-judge panel in Berlin ruled on Friday in favor of the artistic freedom of the choirmaster. The head judge said that the case was about the conflict between artistic freedom and the expectation of equal rights guaranteed by German constitutional law.

The judge described the case as a test case and allowed for an appeal.

The State and Cathedral Choir of Berlin, founded in 1465 by the ruler of Brandenburg, Frederick II, promotes “free musical education for boys,” according to the institution’s website. At the time of its founding, girls and women were not allowed to speak or sing in church, so five choirboys were chosen to make up the ensemble.

Since then, the choir has grown into a public institution that includes more than 250 singers in 11 ensembles who undergo rigorous voice training and perform around the globe. What had not changed in more than 550 years is that it has only accepted boys.

Germany’s tradition of boys’ choirs includes the St. Thomas Choir in Leipzig and the Kreuzchor in Dresden, steeped in a tradition that interweaves faith and classical music. Along with the State and Cathedral Choir, they are all publicly funded.