Livestock farmers who cull unwanted, day-old male chicks are within their rights, the High Administrative Court in the western German city of Münster ruled on Friday.
In this case, the court said that the "ethical aspects of animal welfare and human-use interests" needed to be weighed against each other.
They ruled that animal protection laws allow for animals to be slaughtered if there are sound economic reasons to do so.
"Breeding male chicks is not in keeping with the stated goal of chicken breeding and its business guidelines," stated the court, arguing that killing the chicks was "part of the process for providing the population with eggs and meat."
Male chicks are generally regarded as useless for farmers as they don't produce eggs and put on very little meat.
The day-old hatchlings are either chopped to pieces in a shredder or gassed using carbon dioxide. Only a small portion are used for animal feed. Animal rights activists have decried the practice and equated it to mass murder.
According to the court, farmers slaughtered as many as 45 million male chicks in 2012.
The case wound up in the courts after the western state of North Rhine-Westphalia attempted to ban killing male chicks for economic reasons. The state's agriculture minister, Johannes Remmel of the Green party, said "we must finally stop treating animals like garbage," but acknowledged he would have to accept Friday's setback.
Although the ruling does not have nationwide effect, it will likely be referenced should the issue come up before another German court.
The German government also previously rejected a ban, and the national agriculture minister, Bavarian conservative Christian Schmidt, has argued for "a practical alternative to the shredding of chicks by 2017." This would involve laser technology allowing the future sex of chickens within eggs to be determined before they hatch. However, the judges on Friday said that this method was not yet ready for practical application.
rs/msh (AFP, dpa, epd)