(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.
As soon as the technology is available nationwide, the Animal Welfare Act, which prohibits chick culling, will automatically apply, they added.
There are several methods that allow hatcheries to identify the sex of an embryo in an egg, which would allow industries to destroy unwanted male eggs before hatching. However, Judge Renate Philipp said there were "reasonable grounds" for the current practice to continue "until methods to determine sex in the egg" were developed, Agence France-Presse (AFP) reported.
AFP reported that the dispute began when the state of North Rhine-Westphalia outlawed the killing of male chicks under the Animal Protection Act in 2013. Two hatcheries challenged the ruling at district level, and the case was escalated to federal court.
Several methods are used in the industry to kill the animals, including maceration -- where chicks are put through a high speed grinder -- and the use of inert gases such as argon or nitrogen.
British animal rights organization The Royal Society for the Prevention of Cruelty to Animals has previously said that while the thought of maceration and killing of chicks by gas can be "distressing," both methods "can offer humane methods of euthanasia, as long as they are carried out correctly by trained, competent staff."