After Texas A&M University elected its first openly gay student president, Secretary of Energy Rick Perry took a break from national politics on Wednesday to question if his alma mater’s election process was rigged in the name of diversity.

In an editorial published Wednesday in the Houston Chronicle, the former Texas governor called the election victory of 21-year-old junior Bobby Brooks a "mockery of due process and transparency" and suggested the university's decision was based on a "quest for diversity."

"At worst, the [student government association] allowed an election to be stolen outright," Perry wrote.

Perry's 850-word letter comes two days after the traditionally conservative school elected Brooks as its first openly gay student body president. Brooks lost the popular vote but won the election after his opponent, Robert McIntosh, was disqualified by the student government and the university's judicial court based on reports that his campaign didn't provide receipts for glow sticks used in a Facebook campaign video.

Secretary of Energy Rick Perry Olivier Douliery / Olivier Douliery/Pool via CNP/AP

He also alleged that a series of the voter intimidation complaints made against McIntosh were submitted by Brooks' supporters in "a series of dirty campaign tactics."

"Brooks' presidency is being treated as a victory for 'diversity.' It is difficult to escape the perception that this quest for 'diversity' is the real reason the election outcome was overturned," Perry wrote. "Does the principle of 'diversity' override and supersede all other values of our Aggie Honor Code?"

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

In a statement to NBC News, Texas A&M pushed back against Perry's op-ed and said McIntosh’s disqualification represents the school's commitment to accountability.

"To suggest that the same decision of disqualification would not have been made if the roles were reversed is to deny the Texas A&M of today where accountability applies to all," said Texas A&M spokesperson Amy Smith.

Smith said the school was surprised by Perry's editorial, but insists that the election results were determined in accordance with the student government constitution and by-laws. The elections are run by students, not administrators.

The speaker of the Student Senate declined to comment to NBC News on the matter.

McIntosh, a senior at the school, told the school paper that he was grateful and humbled by Perry's support.

“He made a compelling case which I fully support and continue to fight for," McIntosh told the Battalion. "Our campaign team won the election and was subsequently disqualified unfairly. Diversity, at it's heart, is equal treatment of all, and we hope this situation is resolved in a way that ensures a fair and more transparent process now and in future elections."

The Washington Post reported that McIntosh is the son of a Dallas-based Republican donor who campaigned for Donald Trump during the 2016 presidential election.

Conservative radio host and one-time Republican presidential candidate Herman Cain took to Twitter to defend Perry.

Houston Chronicle wants you to think Rick Perry attacked Texas A&M for electing a gay student government leader https://t.co/hrFq4gptLb pic.twitter.com/2xEZ1H2FLJ — Herman Cain (@THEHermanCain) March 23, 2017

Meanwhile, Human Rights Campaign President Chad Griffin criticized Perry, writing in a tweet, "Rick Perry, busy running a department he forgot he wanted to eliminate, somehow found time to smear a young gay trailblazer in Texas."

Rick Perry, busy running a department he forgot he wanted to eliminate, somehow found time to smear a young gay trailblazer in Texas. https://t.co/Y8YOjimyr2 — Chad Griffin (@ChadHGriffin) March 23, 2017

Sarah Kate Ellis, president of the Gay & Lesbian Alliance Against Defamation, said she was "disgusted" by Perry's letter.

"It takes a lot of nerve for 67 year old [Perry] to bully a college junior for fairly winning an election," she wrote. "Some advice for [Perry]: Kids like Bobby Brooks are the future, and should be encouraged, not harassed."

Speaking to the Chronicle, Brooks said he was focused on improving diversity at Texas A&M, but did not make his sexuality the focal point of his campaign. He will begin serving as the school's president in April.