The Margaret Chase Smith Federal Building in Bangor

A federal judge Thursday rejected recommendations from a prosecutor and defense attorney and sentenced a former Maine man to five years in federal prison, the maximum term of imprisonment for stalking.

Donald Cain, 49, of Henderson, Nevada — formerly of Conroe, Texas, Columbia, South Carolina and Calais — pleaded guilty to the charge on Jan. 11 in U.S. District Court in Bangor in the same courtroom where he was sentenced, according to the court’s electronic case filing system.

In imposing the sentence, U.S. District Judge John Woodcock described Cain’s conduct as “utterly reprehensible,” according to a release from the U.S. Attorney’s Office. The judge said it constituted a “psychological assault” and that he had “never before seen a stalking crime of such length, intensity, vulgarity, scope, sophistication and impact.”

Cain’s attorney, Hunter Tzovarras of Bangor, filed a notice of appeal to the 1st U.S. Circuit Court of Appeals in Boston immediately after the sentencing.

Tzovarras said Thursday in an email that everyone in the courtroom, including Mr. Cain, was surprised by the length of the sentence the judge imposed.

“[The prosecution] recommended a 30-month sentence and we asked for a sentence of less than 30 months,” the attorney said. “The court doubled the prosecutor’s sentencing recommendation. Sixty months in federal prison is far too long for Mr. Cain, who is a family man with no history of violence, has been a productive hard working member of society all of his adult life, has taken responsibility for his conduct, and is over two years removed from the criminal conduct that was by all accounts out of character for Mr. Cain.”

Assistant U.S. Attorney Darcie McElwee, who prosecuted the case, said Friday that the plea agreement called for her to recommend a sentence at the low end of the federal sentencing guideline range. That range was 30 to 37 months, she said in an email.

By pleading guilty, Cain admitted that between November 2014 and December 2015 that he called and sent threatening text messages to his wife that caused her substantial emotional distress. Cain married a Houlton resident in August 2014 but soon moved out of state for work, according to court documents.

The couple has since divorced. The victim is identified only by her initials in court documents.

Woodcock said in an order to revoke Cain’s bail that the content of the calls and texts included “threats to kill his ex-wife’s mother, hundreds of telephone calls and text messages, threats to kill his ex-wife and her new boyfriend, threats to send videotapes of [her] having consensual sex to members of [her] family, threats to rape [her] daughter, all in vile and violent language.”

Cain made his first court appearance in Bangor in January 2015, after being arrested the previous month in South Carolina, and was released on bail. Cain’s case was delayed after he changed attorneys several times..

His bail was revoked on June 1 after he was charged in Nevada with drunken driving and speeding, according to court documents. His blood alcohol level was .15 percent, nearly twice the legal limit of .08 percent in that state. His bail conditions banned him from drinking alcohol.

In addition to prison time, Cain was sentenced to three years of supervised release. On Thursday, two charges of harassment were dismissed as called for in Cain’s plea agreement with the U.S. Attorney’s Office.

The investigation was conducted by the Houlton Police Department, the San Antonio, Texas Police Department, the Maine Computer Crimes Task Force and the FBI in Maine and South Carolina.

Follow the Bangor Daily News on Facebook for the latest Maine news.