Updated

"What if I catch him with a dude?" Dharun Ravi wondered in jocular web chat about his new, gay freshman-year roommate at Rutgers University. He pondered a computer program to alert him if Tyler Clementi tried to rape him at night.

In his own musings in those first days of dorm life a year ago, Clementi wrote, "I got an azn," or Asian, for a roommate. His family is "soo Indian/first gen Americanish," he wrote.

Those snippets of court documents released in recent weeks paint a picture of a relationship that started out tense even before the two met, before Clementi committed suicide and before they became characters in a drama that would stir reaction from celebrities, lawmakers and even the White House.

Ravi, 19, heads to court Friday for a hearing in which his lawyers will ask a judge to throw out the 15-count indictment accusing him of a hate crime, invasion of privacy and tampering with evidence. Authorities say he used a dorm-room webcam to spy on Clementi's intimate encounter with another man.

Clementi, 18 when he died, became a worldwide symbol of the consequences of bullying and intimidation after he jumped off the George Washington Bridge into the Hudson River amid the intrigue in Davidson Residence Hall C on the New Brunswick campus of New Jersey's flagship university.

The court papers show modern intrigue spelled out in texts and tweets, many jokey, some confessional. Along with computer records are interview transcripts that could become the heart of the evidence if the case goes to trial. The tension between the roommates began before the campus move in date of Aug. 28, 2010.

In an Aug. 22 instant messages to a friend, Ravi disclosed he'd done some searches to learn about his roommate. Ravi made fun of Clementi's Internet postings about asthma treatments, violins, gardening and Internet security — and his sexual orientation.

In one exchange, Ravi wrote "idc" — short for "I don't care" — that Clementi was gay. But he chatted repeatedly with friends about it.

Though it appears the roommates never discussed Clementi's sexual orientation, it was a frequent topic in other conversations held by Clementi, who in those first weeks of college told his family he was gay, attended a meeting of a campus gay-rights group and made arrangements to meet alone with a man.

Clementi noticed that Ravi changed his pants in a closet.

"It's like the most awkward thing you've ever seen," he wrote to a friend. He also noticed that Ravi's webcam was pointed toward Clementi's bed: "I feel like he's watching me watching him."

There were more common roommate tensions, too. Clementi, who said he liked to have a lot of time alone, told friends his roommate would party until 5 a.m.

They lived across the hall from Molly Wei, who had known Ravi since middle school. She told investigators in interviews that she had a falling-out with him because he lied so much. But when she saw that they would be living across the hall, she said, she decided to give him a clean start.

Around 9 p.m. Sept. 19, she said, Ravi came to her room. Clementi wanted to have someone over privately.

Wei said people in the dorm saw an unfamiliar older man who looked homeless — Clementi's guest. Ravi was afraid his iPad would be stolen — and was also curious about what was happening in the room from which he was exiled, Wei said.

During a moment when Clementi and the man were out of the room, he went in, turned on his webcam and set it up so he could view whatever it showed from Wei's computer, Wei said.

Later, they turned on the video stream. "We saw Tyler and the other guy, like, they were touching each other and, like, I think, kissing," she told investigators. "And then after, like, two or three seconds when we realized what we were watching, we just turned it off."

Later that night, Wei said, she briefly turned the video chat back on to show her roommate and some other women from the dorm. She said Clementi and the other man had their shirts off.

Wei chatted with her boyfriend at another college about what she had seen. In a detail previously noted in court papers, Ravi used his Twitter account to tell the world about it: "I saw him making out with a dude. Yay."

According to an email Clementi later sent to a resident assistant, the tweet tipped him off that he had been watched.

The next night, he chatted with a friend that he felt violated when he realized what had happened. "But then when I remembered what actually happened... doesn't seem soooo bad lol."

And the night after that, Sept. 21, it happened again. Clementi asked for the room and said he found Ravi's webcam on and pointed at his bed.

And Ravi, who lives in Plainsboro, took to Twitter again: "Anyone with iChat, I dare you to video chat me between the hours of 9:30 and 12. Yes, it's happening again."

Ravi's defense lawyer, Steven Altman, says that Ravi was joking and had disabled his webcam. But in a message to a friend, Clementi said it was he who turned off the webcam before the man, identified only in court papers as "M.B.", came over.

Around 3 a.m. Sept. 22, Clementi sent an email to his resident adviser detailing what had happened. It ended: "I feel that my privacy has been violated and I am extremely uncomfortable sharing a room with someone who would act in this wildly inappropriate manner."

That night, he left a last message on his Facebook page: "Jumping off the gw bridge, sorry." His car and wallet were later found on the George Washington Bridge, and his body was discovered days later.

Five minutes after the Facebook posting, Ravi sent Clementi a long text message.

"I turned on my camera and saw you in the corner of the screen and I immediately closed it. I felt uncomfortable and guilty of what happened," it said. "Obviously I told people what occurred so they could give me advice. Then Tuesday when you requested the room again I wanted to make sure what happened Sunday wouldn't happen again ... I turned my camera away and put my computer to sleep so even if anyone tried it wouldn't work. I wanted to make amends for Sunday night. I'm sorry if you heard something distorted and disturbing but I assure you all my actions were good natured."

Another said, in part: "I've known you were gay and I have no problem with it."

Prosecutors suggest he composed the message only after seeing the suicide threat Clementi had posted on Facebook. Altman says he was writing the same time as Clementi.

It's not clear whether Clementi ever saw the messages, but his legacy was quickly felt.

Talk show host Ellen DeGeneres was among the celebrities to champion the anti-bullying cause. Even President Barack Obama and Secretary of State Hillary Rodham Clinton weighed in on the issue, filming videos encouraging bullied teens to hang in there.

New Jersey lawmakers quickly passed a law, a year in the making, to have the nation's toughest anti-bullying laws in schools, although activists say the state has been too slow to finalize the regulations to go with them. And Rutgers has instituted a policy allowing opposite-sex roommates to provide a comfort zone for gay, lesbian and transgender students.

Wei, charged with two counts of invasion of privacy, is cooperating with authorities and has entered a pretrial intervention program that could result in charges being dropped. Ravi is fighting the 15-count indictment, which includes a bias intimidation charge punishable by as many as 10 years in state prison.

In court Friday in New Brunswick, his lawyers will try to have the indictment dismissed, and to force the state to reveal the identity of M.B.

Prosecutors say that they have given the defense statements from the man — they were not disclosed in the legal filings — and that he is willing to meet with defense lawyers in the presence of prosecutors. But they argue his identity can remain concealed because he is a victim of a sex crime.