A Florida high school student elected class president was disqualified and given detention after the principal accused him of harassing an opponent in a pre-election speech that invoked President Trump’s proposed border wall.

Vero Beach High School junior J.P. Krause told "Fox & Friends" Sunday that the disqualification and punishment were “completely outrageous.”

He said he got in trouble for an off-the-cuff speech he gave to an AP History class the day before the election in April.

In the 90-second speech, J.P. accused another candidate of representing a rival school and proposed that “we build a wall” between the two schools and have the other school pay for it. He also accused the rival of representing "Communist ideas."

A classmate recorded it and posted it online. In the video students are heard laughing.

J.P. was disqualified after the election by Vero High Principal Shawn O’Keefe.

“Speeches must focus on reality and pertinent issues,” O’Keefe said in a statement. “The insulting language in this speech was of a nature that created a situation of public humiliation and therefore violated school district rules pertaining to harassment.”

J.P. says he wasn’t trying to harass anyone.

“I never thought the speech would ever evolve in what it has become, really,” he said on "Fox & Friends." “It was completely a joke from the beginning and completely satirical.”

He shrugged when asked if the reason he got in trouble was because he sounded too much like Trump.

“Honestly, I couldn’t tell you, but it’s there,” he replied.

His mom told WPTV she wishes the situation could have been handled better.

Angela Krause said she worries the harassment charge could affect him when he applies to college.

“I don’t think there was anything wrong,” she said. “He was being silly. He’s 17.”

The station reported that J.P.'s plight caught the attention of the Pacific Legal Foundation, which is now providing legal counsel for free.

The foundation sent a letter to the school district stating that the disqualification violated JP’s constitutional rights and requesting that he be declared class president, according to the station.