The nationalist anti-immigration government of Prime Minister Viktor Orban ordered the migrants into transit zones and limited their ability to apply for asylum.
The court found Hungary did not allow asylum-seekers to leave detention centers while their cases were considered and offered no special protection to children and the vulnerable.
Where asylum claims were rejected, in some cases "those nationals are forcibly escorted, by the police, from the other side of a fence erected a few meters from the border with Serbia, to a strip of land devoid of any infrastructure," the court said in a news release.
This was deemed a breach of an EU directive establishing safeguards for the removal of illegal immigrants.
The court ruling came on the same day Hungary issued a detailed response to the European Commission's Action Plan on Integration and Inclusion, which Orban said Hungary opposes "with all its might."
The action plan was presented by the European Commission on November 24. It brings forward a framework to meet the challenges newcomers face when they move to the EU, with particular regard to education and training, employment and skills, health and housing.
Hungary's secretary of state for international relations, Zoltan Kovacs, said on Twitter: "While the Action Plan would give immigrants more rights and entitlements, it does not seem to take into consideration the security risks associated with mass migration."
Migration is often a flashpoint between Brussels and Orban's government. It was cited by Hungary as an issue when the country, along with Poland, blocked the $2.2 trillion recovery fund and 2021-27 budget.
A compromise, which delayed making funding conditional on rule-of-law standards, was agreed at the EU leaders' summit last week. Orban's government has accused the EU of trying to force it to accept mass immigration.