AIR FORCE ACADEMY, Colo. -- The leader of the Air Force Academy delivered a poignant and stern message on race relations in a speech to thousands of cadets after someone wrote racial slurs on message boards outside the dorm rooms of five black students.

Lt. Gen. Jay Silveria warned students that he would not tolerate racism at the academy and invoked some of the racial tensions that have been gripping the country. At one point, he insisted that everyone in the audience take out their phones and record him so his message was clearly heard.

"If you can't treat someone with dignity and respect, get out," he said Thursday as audience members looked on with rapt attention.

Get Breaking News Delivered to Your Inbox

Air Force security personnel are investigating the incident after the slurs were discovered Tuesday. Racial slurs are illegal in the military and can bring charges of violating orders and conduct unbecoming an officer.

Officials have said they cannot provide any more information about what happened because of the ongoing investigation. No additional details were released Friday.

Silveria said he called the families of the five prep school students who were the objects of the slurs.

His speech quickly became a widely viewed video online, coming in the aftermath of racial violence in Charlottesville, Virginia, and the debate about NFL players kneeling for the national anthem.

"We would also be tone deaf not to think about the backdrop of what is going on in our country. Things like Charlottesville, Ferguson, the protests in the NFL," he said.

Silveria, a veteran fighter pilot who directed the air war in the Middle East, took command at the school in August. The academy has struggled with sexual misconduct problems several times in recent years, and the 1985 academy graduate and son of an Air Force master sergeant has repeatedly told cadets and staff that his highest priority is ensuring a climate of dignity and respect.

When Silveria took over as the school's leader, he told The Gazette: "My red line is cadets who can't treat each other with respect and dignity."

Silveria enrolled in the academy a year after it graduated its first female cadets. His class was 7 percent black compared with 8 percent in 2015. About 29 percent of the academy's cadets were minorities in 2015, according to the school's website. Ten percent were Hispanic, 10 percent Asian and Pacific islander and 1 percent Native American.

The preparatory school has a 10-month program for potential cadets who applied for the four-year academic and military program at the academy but were not accepted. The goal is to help them meet academy requirements.

The prep school usually accepts about 240 students. The academy itself has about 4,000 students.

Silveria has flown combat missions in Iraq and the Balkans and formerly served as the vice commander at Bagram Air Base in Afghanistan.