NEW BRUNSWICK, N.J. — A former Rutgers student accused of using a webcam to spy on his roommate’s intimate encounter with another man rejected a plea deal on Friday that would have kept him out of prison and sought to prevent his deportation, accepting the gamble of a trial.

Dharun Ravi’s lawyer, Steven Altman, said his client’s reason was simple. “He’s innocent. He’s not guilty,” Altman said after the court hearing. “That’s why he rejected the plea.”

Ravi has less than a month to reconsider before summonses are sent to prospective jurors and the judge in the case says he’ll close the window of opportunity for a negotiated plea bargain.

With Friday’s rejection, it looks more likely that Ravi will stand trial next year. The trial is scheduled to begin Feb. 21 and is expected to take about three weeks, the judge said.

The case sparked a national conversation about the way gay youth can be bullied when the victim, 18-year-old Rutgers student Tyler Clementi, committed suicide days after the alleged spying in September 2010. Like Ravi, he was in his first weeks of his first semester at Rutgers. Court filings of emails, text messages and instant messages show there were tensions between the two students — and that Clementi’s being gay was apparently one reason.

Ravi, 19, is not charged in connection with Clementi’s death.

He does face 15 criminal counts, including invasion of privacy, witness and evidence tampering and bias intimidation. The latter is a hate crime under New Jersey law and is punishable by up to 10 years in state prison.

In October, Ravi formally rejected a plea bargain that would have come with a recommended sentence of three to five years in prison, but with a chance that the judge could waive any prison time.

Clementi’s family issued a statement later in October saying that there should be a full accounting of the events that led to Clementi’s death, but that a harsh punishment was not necessary for justice to be done.

On Friday, Superior Court Judge Glenn Berman laid out some of the terms of the new offer: Ravi would be put on probation, be required to do 600 hours of community service and receive counseling. Also, the state would help him try to stave off any attempt by the federal government to deport him.

Ravi, who lives in Plainsboro, is in the United States legally but is a citizen of India. Altman said in court that he could face deportation if he’s convicted — if the federal government views any offenses as “aggravated.”

First Assistant Middlesex County Prosecutor Julia McClure said any help would go away if he rejects the plea offer.

About 20 people were in the New Brunswick courtroom showing support for Ravi.