If all Stephen Espalin wanted was some "Obamacare," he picked a very inappropriate way to get it.

Espalin, 57, told a federal judge Friday that he only threatened to assassinate President Obama, his family and their dog, Bo, because the homeless man needed medical treatment for chest pains but was being kicked out of a Boca Raton hospital for giving a false name and lying about having health insurance.

"I would have no intent to hurt the president," Espalin said. "I realize it wasn't the right thing to do. I uttered those words knowing the [federal agents] would come and take care of me."

It wasn't the first time Espalin used that extreme tactic to get medical attention. He previously served 18 months in federal prison for threatening to kill former President George W. Bush in 2001, court records show.

He made the more recent threat during a very cold weather spell on Dec. 9, 2010.

Espalin uses a wheelchair and received chemotherapy treatment in federal custody while awaiting sentencing. He is expected to undergo heart surgery while he is locked up, according to documents filed by his lawyer, Assistant Federal Public Defender Robin Rosen-Evans.

"I think it is clearly apparent [he] had personally no intent and clearly had no ability to carry out a threat against the president," Rosen-Evans told Senior U.S. District Judge Kenneth Ryskamp at the sentencing hearing in West Palm Beach. "

Rosen-Evans said hospital officials had called police so Espalin reverted to what worked in the past and made a hollow threat so he would be taken into federal custody.

Though Espalin told Boca Raton police and U.S. Secret Service agents he had sent a heat-activated bomb to the president at the White House, there was no evidence any such explosive device was sent, authorities said.

Prosecutor Stephanie Evans said Espalin was about to be arrested and taken to the county jail where he would have received medical treatment.

She said the threat was a very serious crime that was treated extremely seriously by federal authorities. Noting that he has a lengthy criminal history and is a convicted sex offender who was recently sentenced on state charges for failing to register where he lived in Florida, the prosecutor said he was "so off balance" that he seemed likely to have followed through on the threat.

The judge sentenced Espalin to four years and three months in federal prison, the highest punishment suggested by sentencing guidelines. He also ordered him to undergo mental health treatment and recommended he be imprisoned at a prison with specialist medical care.

Espalin apologized and expressed regret for costing the justice system time and money.