(CNN) A German court has ruled that the poultry industry practice of killing unwanted chicks is still lawful, until an alternative can be found.

The ruling, made by Germany's Federal Administrative Court on Thursday, ordered that the slaughtering of male chicks should continue until methods are developed to determine the sex of an embryo in the egg.

Male chicks are considered redundant by both egg and poultry producers -- the former only uses cockerels in breeding programs for insemination, while the latter prizes faster-growing hens for meat. As a result, they are routinely killed in vast numbers in industrial farming around the world.

Among the opponents of the controversial practice is Germany's federal minister of food and agriculture Julia Klöckner, who said in a statement following the ruling: "My position on chick deaths has long been clear: ethically it's not justifiable. The practice has to end as quickly as possible."

A spokesperson for Germany's Federal Ministry and Food and Agriculture told CNN that the ministry has invested in 5 million euros ($5.6 million) in ovo sex determination technology -- also called "Seleggt technology" -- which will be at the disposal of German hatcheries next year.

Read More