A Jordanian man caught in an FBI sting trying to blow up a Dallas skyscraper was sentenced Tuesday to 24 years in prison after telling the court he was ashamed of his actions and renouncing al-Qaida.

Hosam Smadi, 20, faced up to life in prison but received a reduced sentence after pleading guilty in May to attempted use of a weapon of mass destruction. U.S. District Judge Barbara Lynn could have sentenced him to a maximum of 30 years under the plea agreement.

Just before being sentenced, Smadi addressed the court.

"I'm so ashamed for what I did. I'm very sorry for my actions," Smadi told Lynn just before he was sentenced. "I could not live with myself if I had hurt anybody."

Smadi also renounced al-Qaida and called its leader, Osama bin Laden, "a bad man."

Smadi acknowledged leaving what he thought was a truck bomb in a garage beneath the 60-story Fountain Place building in September 2009. Smadi said he parked the truck, activated a timer connected to the decoy provided by undercover FBI agents, then rode away to watch the explosion.

Smadi dialed a cell phone number from the roof of a nearby parking garage, where he had planned to watch the explosion. The number was supposed to set off his truck bomb. It instead alerted tactical agents hiding in a stairwell, who swarmed the rooftop and arrested the teenager.

"Every day, I want you to think about the people in that building," Lynn said while sentencing Smadi. "They are your sisters. They are your teachers. They are your neighbors. And you were prepared to end their lives."

Smadi showed no emotion as he heard the sentence, but his father and sister sobbed.

In an unusual move, Lynn agreed to let Smadi spend two hours with his family later Tuesday before he is taken to federal prison. She recommended that he receive mental health and drug abuse treatment while in prison. Lynn did not order him to pay a fine because she said he wouldn't be able to afford it anyway.

He will be deported after serving his sentence, U.S. Attorney James Jacks said.

"We of course would have liked a lower sentence, but we're satisfied the process was fair," defense attorney Peter Fleury said after the hearing.

In his closing address, Fleury argued that the FBI had created a terrorist instead of catching one. But government lawyers argued they prevented a would-be terrorist from killing innocent people.

"We didn't pick the target," said Robert Casey, the head of the FBI's Dallas office. "It was our job to manage the aftermath."

The FBI said it discovered Smadi as he was looking on an extremist website for financial backing and strategic insight to commit terrorism. Posing as members of an al-Qaida sleeper cell, three undercover FBI employees monitored Smadi beginning in January 2009. After he shared his plans to blow up the office tower, they helped him secure a truck and fake bomb used to carry out the mission, according to court documents.

Had they not intervened, officials said, Smadi could have made contact with actual terrorists, instead of the undercover FBI employees who helped him secure and plant a bomb.

"How grateful we should be that law enforcement found him first," federal prosecutor Dayle Elieson said.

That argument seemed compelling to Lynn, who referenced it when announcing her sentence from the bench.

"Someone else might have taken the bait that you put out there," Lynn said.

Elieson also discounted testimony from Smadi's father and neighbor in Jordan, both of whom said the elder Smadi regularly beat his son. Smadi also suffered greatly after his mother's death, sleeping by her grave site and even trying to revive her with shock paddles after medical personnel declared her dead, the men said.

"While he has a tough background, there are a lot of people from the same background who don't bomb buildings," Elieson said.

Since the arrest, Smadi's public defenders have portrayed their client as a troubled and depressed young man, who exhibited signs of depression and mental illness when his parents separated and then suffered a breakdown after his mother's death from cancer. At the plea hearing in May, Fleury said Smadi had been diagnosed with schizophrenia by a prison doctor and a physician working for the defense.

A forensic psychiatrist testifying for the government said he believed Smadi was faking symptoms of psychosis, such as when the defendant told the physician that he was hearing voices from a donkey.