NEW BRUNSWICK, N.J. — After discovering that his roommate had set up a webcam in their room and watched him kissing a man, Tyler Clementi sent an e-mail to the resident assistant in the dormitory that said, “I feel my privacy has been violated, and I am extremely uncomfortable sharing a room with someone who would act in this wildly inappropriate manner.”

The next day, Mr. Clementi, an 18-year-old Rutgers student, jumped to his death from the George Washington Bridge.

The resident assistant, Raahi Grover, testified in Middlesex County Court here on Wednesday that when he went to Mr. Clementi’s roommate, Dharun Ravi, after the suicide, he tried to explain himself.

“I told him, ‘It’s not me who needs to be explained to,’ ” Mr. Grover said.

Mr. Ravi, now 20, is facing up to 10 years in prison on charges of invasion of privacy, bias intimidation and hindering apprehension. Prosecutors said that shortly after the roommates arrived at Rutgers in September 2010, Mr. Ravi trained the webcam on Mr. Clementi and a date whom Mr. Clementi had invited to his room, and then encouraged others to watch in what the prosecutors said amounted to a campaign of harassment because Mr. Clementi was gay.