An engineering graduate student accused of killing a friend inside a Silver Spring apartment used a knife pulled from a kitchen butcher block and inflicted seven or eight stab wounds, a Montgomery County prosecutor said in court Tuesday.

“This was a vicious attack,” Assistant State’s Attorney Stephen Chaikin said.

The victim, Mark Edward Waugh, 23, suffered wounds to the jugular vein, upper chest and back, prosecutors said. The blow to the back punctured a lung. Waugh also had wounds that indicated he tried to protect himself.

“The victim, and it’s obvious by the forensic evidence, defended himself from a savage knife attack,” Chaikin said.

The hearing in Montgomery County District Court centered on the $2 million jail bond that was set for the suspect, Rahul Gupta, 24, after his arrest Sunday. Gupta’s attorney, Reginald W. Bours III, asked that the bond be lowered to $50,000 so Gupta could be released.

“I believe the evidence will ultimately show that he has a valid defense,” Bours said. “It’s particularly tragic for someone who has a defense, and who has a promising career and a proven track record at school, to be held on a bond of this amount.”

But Judge William G. Simmons declined to reduce Gupta’s bond.

Gupta was not in court but participated in the hearing via video feed from the Montgomery County jail, as is customary for bond hearings in the county. He said little, stood behind a lectern and at one point buried his face in his hands.

Just days ago, he and Waugh appeared to have promising futures. The two were friends at Langley High School in McLean, Va., and took several Advanced Placement and honors classes together.

Waugh was a first-year law school at Georgetown University. Gupta was pursuing a master’s degree in biomedical engineering from George Washington University.

On Saturday night, the two went out to celebrate Gupta’s birthday, joined by Gupta’s girlfriend and another friend, according to charging papers filed in the case. Three members of the party — Waugh, Gupta and Gupta’s girlfriend — returned to the high-rise apartment in downtown Silver Spring where Gupta and his girlfriend were living. The drinking continued. Then confusion, yelling and a 911 call.

Officers who arrived found blood on walls of the kitchen and living areas of the small apartment, the court papers say. Gupta was not injured and immediately told officers that he had caught his girlfriend and Waugh cheating and that he had killed Waugh, according to police accounts in arrest documents. “I walked in on my girlfriend cheating on me,” Gupta told the officers, according to the documents.

In court Tuesday, Bours said the remarks didn’t make much sense: The apartment is a studio, Bours said, and the three were there together. The attorney questioned how Gupta could have walked in on the other two.

The arrest records show Gupta giving different accounts to police — including an assertion at one point that Waugh tried to kill him. Chaikin, the prosecutor, noted that Gupta was not injured.

Bours handed the judge a copy of Gupta’s résumé and school records. The attorney noted that his client’s parents were in court and that they would be willing to keep their son at their home if he was released. Bours said they are of “middle-class means” and own a business based in Northern Virginia that employs about 15 people.

Chaikin argued that the defendant’s background and accomplishments shouldn’t carry much weight. “All these facts, and this wonderful résumé and background, were a different time period in this defendant’s life,” Chaikin said. “He’s on a different path now.”