CAMBRIDGE - After Anna Tang and her boyfriend broke up three weeks ago, prosecutors say, the Wellesley College junior began sending him e-mails telling him she would kill him.

Yesterday, police said, she almost succeeded.

At about 6:30 a.m., Tang sneaked into his dorm room at MIT, climbed on top of him as he slept, and plunged a knife into his back, Assistant District Attorney Suzanne Kontz said in Cambridge District Court yesterday, where Tang was arraigned.

The man woke, turned around, and tried to fight her off, but Tang kept stabbing him. At one point, she lost her grip on the knife and reached for another she had brought with her, Kontz said. Tang was armed with three knives, the prosecutor said.

The 19-year-old MIT student, who was not identified, is in serious condition at a local hospital, and Tang, who prosecutors said stabbed him seven times, was held without bail until next Tuesday, when she will return to court for a dangerousness hearing. Tang, a slight woman who wore blue hospital scrubs in court, was charged with armed assault with intent to murder and home invasion. A not-guilty plea was entered on her behalf.

"We believe this to be an isolated incident done with specific intent to critically harm the defenseless victim," Middlesex District Attorney Gerard T. Leone Jr. said in a written statement yesterday.

Tang's lawyer, John Valerio of Andover, described the suspect as a "meek, mild-mannered young lady," originally from South Bend, Ind., who is "in a great deal of distress."

"She's in a state of shock," he said after the arraignment, adding that he would investigate the prosecution's allegations. "By all accounts, this is a good girl who has never had problems with the law."

Tang has no prior criminal record, and there had been no restraining order filed against her by the victim, prosecutors said.

Tang and the MIT student broke up after dating for about eight months, Kontz said.

Late Monday night, Tang went to the dorm and waited the entire night before she obtained a key to the victim's bedroom, Kontz said. How Tang obtained the key is still under investigation, according to Leone's office.

The victim managed to fight off Tang, who fled. He called 911, and minutes later police found him covered in blood.

They later found Tang in the building, a black folding buck knife in her backpack. They also found her jacket, covered in blood.

Tang, 20, a computer science major, most recently worked at Brigham and Women's Hospital as a summer student through the undergraduate research program at Massachusetts Institute of Technology. She had been taking courses at MIT, Valerio said.

MIT officials could not be reached last night. Mary Ann Hill, a Wellesley spokeswoman, confirmed that Tang is a student at the college but declined to provide personal information about her.

Hill said the college had not made a decision yet on any disciplinary action against Tang. "I think today our focus was on how to support and to help anyone who might be affected by the situation," she said.

Mark A. Sheldon, a visiting assistant professor of computer science at Wellesley, called Tang a good student who seemed well adjusted. "I don't know quite what to make of it," he said of the charges. "She always struck me as a perfectly normal student."

At MIT yesterday afternoon, students milled around the dorm, a large, brick building called Next House on Memorial Drive overlooking the Charles River.

The building is relatively safe, students said. A resident must have a security card to enter the main building, and students have keys to their rooms.

Security is "pretty tight," said Ananth Swaminathan, 17, who was walking outside the building with his roommate, Taylor Gilbert, 18. Neither freshman knew the victim.

Gilbert said he did not know anything had happened until he saw a police officer and caution tape. "This is sort of unsettling," he said. "You want to make sure the person hurt is going to be OK."

John C. Drake of the Globe staff contributed to this report. Maria Cramer can be reached at mcramer@globe.com.

© Copyright 2007 Globe Newspaper Company.