NEW BRUNSWICK, New Jersey (Reuters) - A former Rutgers University student was sentenced on Monday to 30 days in prison for hate crimes after spying on his roommate's gay encounter with another man.

Dharun Ravi, 20, had faced a maximum of 10 years behind bars for his conviction, which ramped up penalties in the invasion of privacy case in Middlesex County Superior Court in New Jersey. The sentence was imposed by Judge Glenn Berman, who also gave Ravi probation.

Ravi had been accused of using a computer-mounted camera to spy on his roommate Tyler Clementi's gay tryst with an older man in their college dorm room.

Clementi, who was 18, days later committed suicide, and the case drew a national spotlight to gay bullying and the hazards of social media.

Ravi was not charged with causing Clementi's death. He also faces possible deportation because he was born in India, although he grew up in the United States.

(Editing By Barbara Goldberg)