The Orange Coast College Republicans in Costa Mesa, Calif., are filing a complaint against human sexuality professor Olga Perez Stable Cox after video shows her criticizing the outcome of the election. (Editor's note: This video begins mid-sentence and is not the professor's entire speech.) (Orange Coast College Republicans)

A Southern California college student has been suspended for recording his professor’s anti-Trump rant, which went viral and led to violent threats against the instructor.

According to a copy of the suspension letter posted by Campus Reform, the student must also apologize to the professor and submit a double-spaced essay about “why you decided to share the video” and “the ensuing damage to Orange Coast College students, faculty and staff.”

The essay is due by the end of the month. The suspension will last all semester, though 19-year-old Caleb O’Neil will appeal.

The Orange Coast College freshman said Wednesday that he file a lawsuit in federal court if his appeal is rejected.

“We think this is a clear example of unconstitutional viewpoint discrimination that targets conservatives and we’re going to challenge it,” O’Neil’s attorney, Bill Becker, said at a news conference in Costa Mesa, according to CBS Los Angeles.

Becker told the Orange County Register that the suspension “is an attack by leftists in academia to protect the expressive rights of their radical instructors.”

Shortly after Election Day, Olga Perez Stable Cox told her human sexuality class that Trump was a white supremacist.

His victory, she said, was “an act of terrorism.”

“We’re really back to being in a civil war,” the psychology professor said as O’Neil and others listened from their desks.

She didn’t mean a real war, but rather a divided country in which “we are the majority. More of us voted to not have that kind of leadership.”

The professor said “we” — but O’Neil thought otherwise. He recorded the speech and showed it to a campus Republican group, who complained to administrators that Cox was abusing the power of her grade book.

“It’s scaremongering,” a lawyer for the group told the Register. “It’s irrational. It’s a rant. And it doesn’t belong in the classroom.”

Frustrated that the administration did not act on their concerns quickly enough, the Republicans posted clips of the lecture online.

O’Neil’s video prompted headlines across the country and drew a ferocious backlash to the Costa Mesa, Calif., campus.

“I pulled my phone out, because I was honestly scared that I would have repercussions with my grades because she knew I was a Trump supporter,” O’Neil at the news conference Wednesday, according to the Orange County Register.

“I thought Olga was a good teacher,” he added.

Cox, who often turned her classes into open forums on sensitive issues, told The Washington Post that she’d been trying to comfort students scared by Trump’s rhetoric against Muslims, undocumented immigrants and other minority groups.

After weeks of threatening messages in her inbox and voice mail about the video — “Marxist,” “nutcase,” “vile leftist filth” — she became frightened herself.

“Now, at 66, I’m paranoid,” she said in December. “I feel like I’ve been attacked by a mob of people all across the country.”

Campus security began dropping by Cox’s classroom. Sympathetic students escorted her to class, worried about her safety.

She fled her home and turned her class over to a substitute after getting an email that listed her home address, phone number and salary — and threatened to spread the information “everywhere.”

Several weeks later, on Feb. 9, O’Neil got a letter from a dean.

“When we spoke, you stated that you felt badly about the things that had happened to individuals as a result of this incident,” it read.

But the student had also broken campus rules against using recording devices. Thus: a semesterlong suspension, which would only end if he apologized to Cox and wrote a three-page essay about what he did.

“It is my hope that this experience will lead you to truly think through your actions and the consequences of those actions.”

Orange Coast had also been investigating whether Cox’s comments were appropriate, the Register reported. A spokesman for the school told The Post it couldn’t comment on student or personnel matters: “The student made the decision to go to the media; we cannot.”

O’Neil’s attorney said his client would keep attending class while appealing the punishment.

“I’m disgusted that they imposed such excessive sanctions,” the founder of school’s College Republican group told the Register. “The student was just trying to document a case where he personally felt targeted by a faculty member.”

Fred M. Whitaker, chairman of the Republican Party of Orange County, called O’Neil’s suspension “abhorrent,” adding that the college administration’s decision “clearly affirms their disdain for one of our nation’s most cherished freedoms: freedom of speech. The Republican Party of Orange County categorically opposes this administration’s attempt to trample over its students’ civil rights and we will be doing everything in our power to support Caleb O’Neil in his effort to appeal the decision.”

This post, originally published on Feb. 15, has been updated.

More reading:

A United pilot ranted about Trump, Clinton and divorce. Her passengers fled.

‘My daughter’s death will not be used’: Parents furious over Trump’s false terrorism claims

Meet the rookie federal judge who halted Trump’s refugee deportations — to save a Syrian