A shipment of Care Bears to court officials and an email that appeared to reference a mass shooting have landed a former surgical resident in a psychiatric facility while he awaits trial on a stalking charge.

Describing his behavior as bizarre and erratic, prosecutors have asked a judge to revoke Karl Ehrens’ bond to ensure he will go straight to jail should he be released from Palmetto Lowcountry Behavioral Health.

A doctor who evaluated Ehrens on July 25 determined he was mentally ill and posed “a substantial risk of physical harm to himself or others,” according to the prosecution’s motion.

Ehrens, 31, is awaiting trial on a charge of first-degree harassment. The former Medical University of South Carolina surgical resident is accused of stalking an 18-year-old woman in 2010 and exhibiting bizarre behavior after she rejected his romantic advances.

Among other things, she found boxes of stuffed animals in her driveway that resembled images in messages Ehrens had sent her, authorities said.

Ehrens had been free on a $40,000 bond since October 2010. As conditions of bail, he was required to behave himself and have no contact with the victim in the case. He also was ordered to live with his family near Boston and stay out of South Carolina unless he was required to attend a court hearing.

In July, Ehrens returned to Charleston in anticipation of his trial starting on the 30th of the month, according to one of his emails.

On July 20, a heavily taped package from Ehrens arrived at the Charleston County Clerk of Court’s Office in an express delivery, sheriff’s deputies said. Inside were a dozen Care Bears and a blanket.

Given Ehrens’ history, officials called in the Charleston County Sheriff’s Office bomb squad to make sure the package was safe. It was, according to an incident report.

A letter from Ehrens indicated the bears were for use as evidence in his case. The letter, dated July 18, asks that the bears be donated to MUSC Children’s Hospital after the trial. He adds a P.S.: “I request that Grumpy Bear be disregarded.”

The same day, he posted a photo on his Facebook page of two dozen Care Bears lined up on a couch. The caption read: “I am Home.”

The following day, Ehrens sent a message to his bail bondsman and officials from the 9th Circuit Solicitor’s Office thanking them for allowing him to return home and pledging to let them know of his whereabouts.

“I had intended to go to the Citadel Mall theater this evening (call it a hunch), but have decided to forego my plans in favor of a more dramatic conclusion in Court,” he wrote.

The message was sent the day after a gunman went on a shooting rampage at a Denver-area movie theater, killing 12 people during a midnight screening of the Batman film “The Dark Knight Rises.”

A few days after Ehrens sent the email, the Sheriff’s Office SWAT team took him into custody at his West Ashley house. He was placed at the Palmetto treatment facility for emergency care. At an Aug. 7 hearing, a probate judge ordered that Ehrens remain there to receive in-patient treatment, according to the prosecutor’s motion.

In that motion, Assistant Solicitor Amy Harrell alluded to “veiled threats” in Ehrens’ emails and shared other examples of his “bizarre” missives.

In April, for example, he fired off an email to a victim advocate at the solicitor’s office asking if he could propose to the woman he is accused of stalking, according to court documents.

Ehrens followed this a month later with an email to a local attorney seeking to publish his story and donate the proceeds to the MUSC Children’s Hospital.

Then, in June, he sent an email to the Savage law firm and copied the message to Charleston Mayor Joe Riley, Charleston County Sheriff Al Cannon and others. The message included a picture of himself with no shirt on and an offer to pay $100,000 to get through the criminal proceedings and pass the state medical board with “a fresh start and an open door.”

In her motion, Harrell stated there is no evidence that Ehrens had been complying with his doctor’s orders while free on bail and that he was not responding to his defense attorneys.

On Friday, Circuit Judge Kristi Harrington took the motion under advisement, with a ruling expected in 10 days. In the meantime, Ehrens is expected to remain in custody. Harrington also granted Robinson Bonding Co.’s request to be relieved of Ehrens’ bond, meaning he will have to seek a new bail bondsman to back him if he is to get out.

In addition, Harrington granted a request from Ehrens’ lawyers, Bill Runyon and Ashley Ameika, to be removed from the case.

Runyon said they wanted off the case due to “communication issues” with their client.

The suspect’s mother, attorney Doris Ehrens, said she and her son are still looking for new counsel to represent him. She said the prosecution’s effort to revoke her son’s bail are unfair and she insisted he has complied with the conditions of his release.

She declined to comment on the Care Bear shipment or his various emails.

Reach Glenn Smith at 937-5556 or Twitter.com/glennsmith5.