A mental patient who threatened to castrate President Bush was sentenced to federal prison, but a judge ordered him freed because of time he's already served.

Arafat Nijmeh, 27, formerly of Belleville, was sentenced Tuesday to seven months in prison after pleading guilty to two counts of threatening the president.

He was released after U.S. District Judge David Herndon credited him with the eight months he spent in custody after being charged. Nijmeh had been jailed without bail after being declared a flight risk and threat to society.

"This would have been an interesting trial," said his attorney, John O'Gara.

Nijmeh was accused of threatening to harm Bush in comments March 18 to workers at the Alton Mental Health Center and to two Secret Service agents the following day.

The indictment alleged Nijmeh told the agents that his earlier threat to castrate Bush was "not too harsh, considering what he has done to my country."

Nijmeh is a Palestinian born in Israel but O'Gara said he is a U.S. citizen.

Secret Service agent John Brooks has testified that Nijmeh was placed in the center against his will by his mother, who said Nijmeh threatened to slice his brother's throat, crashed his car into the brother's garage and tried to hit a nephew with his car.

Brooks said Nijmeh also told a supervisory nurse at the center he was going to "make her life a living hell" and threatened to kill Jews.