The young tinkerer from Texas who was arrested last year for bringing a homemade alarm clock to school — and was later invited to the White House and Google's world headquarters — has filed a federal lawsuit against his former hometown, accusing it of violating his civil rights as part of a wider pattern of discrimination against African-American students.

Ahmed Mohamed, the 14-year-old son of a Sudanese immigrant who has since moved his family to Qatar, claims in the lawsuit that he was the victim of biased treatment since his arrival in Irving, Texas, as a Muslim third grader, including being singled out for discipline.

But he kept trying to impress his teachers in the Dallas suburb as a way "to make connections and gain acceptance," according to the lawsuit.

That is why, last September, at the start of his freshman year at MacArthur High School, he spent a weekend piecing together the clock, using spare electronics parts left over from his father's failed cell phone business, according to the lawsuit. He showed it to a teacher, who took it and contacted school officials, who in turn called police. Under questioning without his parents, he told them he had made an alarm clock. But he was accused of making a fake bomb, and taken into custody. Charges weren't filed, but he was suspended for three days for violating the student code of conduct.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The case made national news, and prompted the U.S. Justice Department to open an investigation. President Obama, on Twitter, invited Ahmed to the White House and asked him to bring the clock. And he attended a science and technology competition hosted by Google, where he met the company's co-founder, Sergey Brin.

Ahmed's family then moved to Qatar, citing better education opportunities for him, and threats of violence in Irving. Ahmed now has nearly 100,000 Twitter followers — and a profile that refers inquiring journalists to a publicist.

On Monday, in a news conference during a family visit to Texas, Ahmed downplayed his flash of fame, comparing it to the loss of his home and sense of security.

"I really love the States. It's my home. But I couldn't stay," Ahmed told reporters. "I get death threats. It's a really sad reality of it."

Ahmed Mohamed, the 14-year-old who was arrested at MacArthur High School in Irving, Texas for allegedly bringing a hoax bomb to school, speaks during an interview with the Associated Press, Monday, Oct. 19, 2015, in Washington. Andrew Harnik / AP

In Qatar, without his makeshift laboratory, Ahmed said his opportunities to build things have diminished. He hopes one day to study physics and electrical engineering.

The lawsuit was filed on behalf of Ahmed and his father, Mohamed Elhassan Mohamed, and names as defendants the Irving Independent School District, MacArthur principal Daniel Cummings and the city of Irving.

It claims they violated his constitutional protections against illegal arrest and unequal treatment, and discriminated against him in violation of the Civil Rights Act of 1964.

Last year, the family sent the district and the city a letter threatening to sue for $15 million. But that was done by a lawyer who no longer represents them. The lawsuit doesn't mention any dollar amount, and the family's new lawyer, Susan Hutchison, said that should be up to a jury.

U.S. President Barack Obama (2nd R) talks with 14-year-old Ahmed Mohamed (C) during the second Astronomy Night on the South Lawn of the White House October 19, 2015 in Washington, DC. Chip Somodevilla / Getty Images

The Irving school district said it would not respond to the lawsuit until its lawyers could review it. The district "continues to deny violating the student’s rights and will respond to claims in accordance with court rules," the statement said.

The city of Irving said in a statement that it had not yet been served with the lawsuit but was "prepared to vigorously defend itself and the justifiable actions it took in this matter. The legal process will allow all facts to be revealed, and the city welcomes that opportunity."

Ahmed closed his morning news conference with a message for kids and adults who find themselves under arrest. "If you did nothing wrong, you have the right to remain silent. They might not tell that to you, but just know that."