A panel of three judges on Friday became the third federal court to rule that President Donald Trump's effort to exclude people in the country illegally from the numbers used for dividing up congressional seats is unlawful.

The federal court in Maryland prohibited the Commerce Department, which oversees the Census Bureau, from sending to the president any figures that include the number of people in the country illegally in each state when transmitting the apportionment count at the end of the year.

Federal courts in New York and California already have issued similar orders. The Trump administration has appealed the New York case, and the Supreme Court is hearing arguments on it at the end of the month.

The Maryland decision was more like the New York ruling in that it merely found Trump's order unlawful, rather than unconstitutional. The California court decided that Trump's order violated the Constitution and federal law.

The Maryland lawsuit was brought by several advocacy groups and individuals who said Trump's order discriminates against Hispanic people and immigrant communities of color, and that they will be harmed because the states they live in will lose congressional seats if the order is enforced.

The census determines not only how many congressional seats each state gets, but also the distribution of $1.5 trillion a year in federal spending.

The Justice Department, which is representing the Trump administration, didn’t immediately respond to an email inquiry. Department of Justice attorneys had argued the challenge to Trump's order was premature since it was impossible to know its impact until the apportionment numbers are released at the end of the year.

The judges in Maryland wrote that Trump's order upends 230 years of history and violates federal law by completely excluding people in the country illegally from the apportionment count and by requiring the Commerce Department to provide the president with data collected outside the once-a-decade census.

A year before Trump issued the memorandum on the apportionment count, the president had ordered the Census Bureau to collect data from administrative records in order to figure out the number of people illegally residing in the U.S. The judges in Maryland said the Census Bureau can continue collecting that data.

Follow Mike Schneider on Twitter at https://twitter.com/MikeSchneiderAP.