A Texas teenager taken away in handcuffs this week for bringing to his Dallas-area school a homemade clock that staff mistook for a bomb won a personal invitation from President Barack Obama on Wednesday to visit the White House.

Ahmed Mohamed, 14, was accused of making a hoax bomb, police in Irving said. The Council on American-Islamic Relations said he is Muslim and the case serves as an example of the climate of hate and manufactured fear around the religion.

The bespectacled Mohamed is a ninth grader who was led away in handcuffs and a NASA T-shirt from MacArthur High School on Monday for a project he put together to impress his new high school classmates and teachers.

See images of Ahmed Mohamed:

12PHOTOS

Ahmed Mohamed 14 year old student arrested for bringing a clock to school

Ahmed Mohamed (2-L), a 14-year-old Sudanese Muslim teenager from the United States who became an overnight sensation after a Texas teacher mistook his homemade clock for a bomb, looks on during an interview in the capital Khartoum on October 15, 2015. AFP PHOTO / ASHRAF SHAZLY (Photo credit should read ASHRAF SHAZLY/AFP/Getty Images)

NEW YORK, NY - SEPTEMBER 27: Student Ahmed Mohamed (L) and National Geographic Society CEO Gary Knell attend the Social Good Summit at the 92nd Street Y on September 27, 2015 in New York City. (Photo by Mark Sagliocco/Getty Images for Global Goals)

NEW YORK, NY - SEPTEMBER 26: Turkish Prime Minister Ahmet Davutoglu (R) and Sare Davutoglu (L) take a selfie with 14-year-old Muslim boy Ahmed Mohamed (C) arrested for bringing a homemade clock what school officials and police described as a hoax bomb on campus in New York on September 26, 2015. (Photo by Hakan Goktepe/Anadolu Agency/Getty Images)

IRVING, TX - SEPTEMBER 17: Ahmed Mohamed, a Texas Muslim teen arrested after taking his homemade clock to school, explains his clock at his house in Irving, Texas on September 17, 2015. A Texas Muslim teen arrested after taking his homemade clock to school, on Wednesday accepted an invitation by President Barack Obama to show off his invention at the White House. (Photo by Bilgin S. Sasmaz/Anadolu Agency/Getty Images)

IRVING, TX - SEPTEMBER 16: Ahmed Ahmed Mohamed is comforted by his father Mohamed Elhassan Mohamed, as they attend a news conference on September 16, 2015 in Irving, Texas. Mohammed was detained after a high school teacher falsely concluded that a homemade clock he brought to class might be a bomb. The news converence, held outside the Mohammed family home, was hosted by the North Texas Chapter of the Council on American-Islamic Relations. (Photo by Ben Torres/Getty Images)

IRVING, TX - SEPTEMBER 16: 14-year-old Ahmed Ahmed Mohamed stands with his father Mohamed Elhassan Mohamed during a news conference on September 16, 2015 in Irving, Texas. Mohammed was detained after a high school teacher falsely concluded that a homemade clock he brought to class might be a bomb. The news converence, held outside the Mohammed family home, was hosted by the North Texas Chapter of the Council on American-Islamic Relations. (Photo by Ben Torres/Getty Images)

IRVING, TX - SEPTEMBER 16: 14-year-old Ahmed Ahmed Mohamed speaks during a news conference on September 16, 2015 in Irving, Texas. Mohammed was detained after a high school teacher falsely concluded that a homemade clock he brought to class might be a bomb. The news converence, held outside the Mohammed family home, was hosted by the North Texas Chapter of the Council on American-Islamic Relations. (Photo by Ben Torres/Getty Images)

IRVING, TX - SEPTEMBER 16: 14-year-old Ahmed Ahmed Mohamed, surrounded by his family, speaks during a news conference on September 16, 2015 in Irving, Texas. Mohammed was detained after a high school teacher falsely concluded that a homemade clock he brought to class might be a bomb. The news converence, held outside the Mohammed family home, was hosted by the North Texas Chapter of the Council on American-Islamic Relations. (Photo by Ben Torres/Getty Images)

IRVING, TX - SEPTEMBER 16: 14-year-old Ahmed Ahmed Mohamed is greeted by a supporter during a news conference on September 16, 2015 in Irving, Texas. Mohammed was detained after a high school teacher falsely concluded that a homemade clock he brought to class might be a bomb. The news converence, held outside the Mohammed family home, was hosted by the North Texas Chapter of the Council on American-Islamic Relations. (Photo by Ben Torres/Getty Images)

IRVING, TX - SEPTEMBER 16: (L-R) Attorney Linda Moreno, Ahmed Ahmed Mohamed, and Mohamed Elhassan Mohamed address the media during a news conference on September 16, 2015 in Irving, Texas. Mohammed, 14, was detained after a high school teacher falsely concluded that a homemade clock he brought to class might be a bomb. The news converence, held outside the Mohammed family home, was hosted by the North Texas Chapter of the Council on American-Islamic Relations. (Photo by Ben Torres/Getty Images)

Ahmed's sister told me to post this. Yes this situation is real for those questioning. http://t.co/Oxd0JxUS6O

IRVING, TX - SEPTEMBER 16: Israa Abdellah, 17, a student at Jack E. Singley Academy in Irving, Texas, holds a sign in support of Ahmed Ahmed Mohammed on September 16, 2015 in Irving, Texas. Mohammed was detained after a high school teacher falsely concluded that a homemade clock he brought to class might be a bomb. The news converence, held outside the Mohammed family home, was hosted by the North Texas Chapter of the Council on American-Islamic Relations. (Photo by Ben Torres/Getty Images)

Up Next

See Gallery

Discover More Like This

HIDE CAPTION

SHOW CAPTION

of

SEE ALL

BACK TO SLIDE

On Wednesday, he became an Internet sensation.

"Cool clock, Ahmed. Want to bring it to the White House? We should inspire more kids like you to like science. It's what makes America great," a message on Obama's Twitter feed said.

The White House invited Mohamed to participate in its astronomy night next month with NASA astronauts and other young people, spokesman Josh Earnest told reporters.

"In this instance, it's clear that at least some of Ahmed's teachers failed him. That's too bad," he said.

Mohamed told a news conference in front of his house that he was going to Washington for the White House Astronomy Night.

Facebook Chief Executive Mark Zuckerberg also invited the teenager to drop by his California-based company.

"Having the skill and ambition to build something cool should lead to applause, not arrest," he wrote on his Facebook page.

The incident has launched a social media campaign called #IStandWithAhmed, which was the No. 1 trending topic in the United States on Twitter for most of Wednesday with nearly 1 million tweets, many critical of the school district and police.

"I built the clock to impress my teacher but when I showed it to her, she thought it was a threat to her. It was really sad that she took the wrong impression of it and I got arrested for it later that day," he said.

The teenager who dabbles in robotics said he was encouraged by the social media support, loved to invent things and will be looking to transfer to a different high school.

The Irving Independent School District stood behind the teacher.

"Out of an abundance of caution, we had to take action," spokeswoman Lesley Weaver said.

Mohamed was handcuffed and taken to a detention center where he was fingerprinted and had mug shots taken. He was freed when his parents came for him.

Police said the device, which had a digital display and circuit board, was in a case and could be mistaken for a bomb.

Police spokesman James McLellan said Mohamed's religion had nothing to do with their response.

Two school police officers initially questioned the student and he told them he had built a clock.

"He didn't explain properly what it was and they felt compelled to arrest him," McLellan said.

No charges were filed and police said they considered the case closed.