DALLAS – Daily Wire Editor-In-Chief Ben Shapiro did nothing wrong in questioning the motives of Ahmed “Clock Boy” Mohamed, a Muslim student who was detained by police after building a “clock” that resembled a bomb, a Texas court ruled.

A Dallas County District Court judge this week dismissed a defamation lawsuit filed against Shapiro by Mohamed’s father, Mohamed Mohamed, over Shapiro’s comments about the September 2015 incident at MacArthur High School in Irving.

MORE NEWS: From Classroom to Consulate Chef: Culinary Student Lands Dream Job at U.S. Embassy in Paris

Ahmed Mohamed was only a few weeks into school when the then ninth-grader came to class with what he described as an “invention,” which was basically a disassembled clock that was sloppily reassembled in a pencil box.

Mohamed showed his science teacher, who advised him to put it away. Later in the day, when the clock began beeping in his English class, his teacher took action because she believed it looked like a bomb. Mohamed was detained and questioned by police and briefly charged with possessing a hoax bomb, though the charge was later dismissed.

Mohamed’s politically active father, who has ties to terrorist-sponsoring foreign regimes, then took the boy on a world tour and was photographed with wanted war criminal and Sudanese President Omar al-Bashir before visiting the White House at President Obama’s invitation. Obama tweeted support for Ahmed as police investigated the situation.

[xyz-ihs snippet=”NEW-In-Article-Rev-Content-Widget”]

MORE NEWS: Know These Before Moving From Cyprus To The UK

Activist groups including the Council on American Islamic Relations and others, meanwhile, accused officials of Islamophobia while the Center for Security Policy, Glenn Beck, Shapiro, Fox News and other news organizations investigated and opined on Ahmed’s story.

Many of those folks believe the case is an example of “civilization jihad” promoted by the Muslim Brotherhood.

Shapiro told Fox News’ Megyn Kelly the incident “was a setup and … President Obama fell for it because it confirms a couple of his pre-stated biases against police and against people who he perceives to be Islamophobic.”

“Within the first forty-eight hours it was clear that this was a bit of a set-up and it was clear that the story didn’t hold together,” Shapiro said.

Mohamed “took the guts out of an old clock, you can see people do it on YouTube. He literally took the guts out of an old clock, the wiring, and he put it inside of a pencil box and proceeded to bring that into the school and this is not the first family incident that has been like this,” Shapiro said. “His sister had an incident in 2009 that was somewhat similar.”

Mohamed eventually moved to Qatar after receiving a full scholarship to attend a school in Doha, but the boy and his father made a special trip back to Texas during the teen’s summer break last year to file a $15 million federal lawsuit against the city of Irving, the school district, and MacArthur High School Principal Daniel Cummings, EAGnews reports.

Mohamed Mohamed followed up with the defamation lawsuit against Shapiro and other conservative commentators.

On Thursday, Shapiro tweeted the court order on his motion to dismiss the case, which was “well taken and should be and is in all respects granted.”

In addition, “Shapiro is entitled to recover his attorneys’ fees, curt costs, and other expenses in bringing his Motion to Dismiss and defending against Plaintiff’s claims,” the order read.

“Ben Shapiro has always been a steadfast advocate of the First Amendment and there was never any doubt he was going to stand up for his right to speak freely,” Shapiro’s attorney, Kurt Schlichter, told Townhall. “I’m very grateful that the state of Texas takes the First Amendment seriously, I only wish my own state of California would do the same, especially after the fiasco at Berkeley yesterday.”