A Texas school district issued an apology after a high school valedictorian said her principal cut off her microphone after she mentioned the names of Tamir Rice and Trayvon Martin.

"It is never our intent to censor anyone's freedom of speech. Students have that right — Dallas ISD encourages it," a statement the Dallas Independent School District released Monday said.

On June 3, Rooha Haghar, the valedictorian at Emmett J. Conrad High School in Dallas, tweeted that her speech was cut short because she "said the names of black children who had become victims of police brutality."

"Our principal signaled for my mic to be turned off as soon as i said 'trayvon martin and tamir rice' and played it off as a technical difficulty. pathetic," Haghar wrote on Twitter, accompanied by a video of the forced end of the speech.

In the video, Haghar says: "To the kids that were murdered in senseless mass shootings. To Trayvon Martin, Tamir Rice and all the other children who became victims of injustice ..."

Then, her lips keep moving, but she can't be heard because the microphone has stopped working.

Haghar realized what happened, tapped her microphone, flashed a heart symbol with her hands, and then sat down as the crowd cheered. When the school's principal, Temesghen Asmerom, approached the microphone, it was working again.

Haghar tweeted that in addition to mentioning Martin and Rice, she was going to talk about "kids across the globe affected by war, famine, persecution and child labor" and remind her classmates that they have "an obligation to your community, and to the world at large."

She said she showed a copy of her speech to Asmerom before the graduation and he told her to remove Martin's and Rice's names because they would make the speech too political.

Martin, 17, was fatally shot by a neighborhood watch volunteer, George Zimmerman, in February 2012 in Sanford, Florida. Rice, 12, was shot and killed in November 2014 by Cleveland police officer Timothy Loehmann, who was responding to a call about someone pointing a gun at other people. Rice was playing with a pellet gun.

"It is Dallas ISD's practice to review all valedictorian and salutatorian speeches in their entirety. The challenge the school faced in this instance was that the Valedictorian chose to share other remarks that were not prepared with administration's knowledge. As a result, the principal made the decision to limit the student's remarks," the Dallas ISD said in its statement.

"In hindsight, we realize this decision may not have been reflective of the core values we teach our students, as we work to educate leaders of tomorrow. For that, we apologize," the statement said.

Haghar immigrated to the United States with her family from Iran as a child, according to NBCDFW. She plans to attend the University of Texas at Austin and continue advocating for social justice.