CHESTERFIELD COUNTY, Va. -- A United States District Judge has dismissed the case against a man who was charged with a hate crime after police said he attacked a co-worker at the Amazon’s shipping facility in Chester.

Prosecutors said James William Hill willfully caused bodily injury to the victim because of his actual and perceived sexual orientation in May of 2015.

Hill's federal trial began on April 11, but CBS 6 recently learned the judge dismissed the case on April 22.

Hill was originally charged by Chesterfield Police with misdemeanor assault. Then, the U.S. District Attorney’s Office for the Eastern District of Virginia charged Hill under the Matthew Shepard and James Byrd Jr. Hate Crimes Prevention Act (HCPA). The charge came with a potential penalty of 10 years in prison.

The judge ruled the hate crimes prevention act prosecutors used to argue their case didn't apply.

“To summarize, the government met the certification requirement in this case before undertaking this prosecution under the HPCA. Nevertheless, the government can proceed no further because the HPCA as applied to Hill exceeds Congress’s authority under the commerce Clause, rending his prosecution unconstitutional.”

The decision also mentioned Virginia's hate crimes law does not include crimes based on sexual orientation or gender identity, rather hate crimes as criminal or other illegal acts based on “race, religion or national origin.”

The government is appealing the judge's decision to the 4th Circuit Court of Appeals in Richmond.