An appellate judge upheld the 41-month prison sentence for a Chicago Uber driver who posted violent threats on Facebook detailing mass shootings he planned to carry out including one against the city's former mayor, Rahm Emanuel.

Defense attorneys for Mohammad Waqas Khan, who was arrested in May 2015, appealed a court's conviction against the 29-year-old, arguing that Khan never intended to commit the killings that he wrote about on social media.

Khan's attorney, Ellen Domph, said his speech was a form of artistic expression similar to rap lyrics and was protected by the First Amendment.

The U.S. Court of Appeals for the Seventh Circuit found Tuesday that "Khan’s posts were so violent, explicit, and resolute that they constituted threats," and upheld the jury's decision finding him guilty of making interstate threats to injure others.

CHICAGO WEEKEND SHOOTINGS LEAVE 8 DEAD, 40 WOUNDED

Khan also posted photos of himself wearing a black mask and holding a shotgun while complaining about excessive noise in his neighborhood and promising to retaliate.

The appeals court concluded that Khan "connected the date of any attempted murder to his flight out of the country, and bragged about his 'mental fortitude to pull it off.'"

CLICK HERE FOR THE FOX NEWS APP

"These personal referents undercut Khan’s defense that his words were artistic expressions," the court's 22-page opinion said.

"This is enough to reasonably infer Khan’s intent to commit an act of unlawful violence towards a particular group of individuals."