Democratic Congressman Beto O'Rourke of Texas, who is running to unseat Republican Sen. Ted Cruz in next week's midterm election, blasted President Donald Trump in a televised interview on Tuesday night for inviting the nation "to hate openly, unapologetically" and inciting violence.

"I think he's trying to play upon the worst impulses of this country instead of speaking to our ambitions, our hopes, our dreams, those things that we can achieve if we all come together."

—Congressman Beto O'Rourke

His comments during a town hall at the University of Houston broadcast on MSNBC's "Hardball with Chris Matthews" followed a gunman killing 11 people at a synagogue in Pittsburgh last weekend and a man who owns a van plastered in Trump stickers allegedly sending explosive devices to billionaire financier George Soros, high-profile Democrats including former President Barack Obama and the president's 2016 challenger Hillary Clinton, and the Time Warner Center in New York City, the location of CNN's headquarters.

"The invitation to hate openly, unapologetically; to call Mexican immigrants rapists and criminals; to call asylum-seekers animals, an infestation; to describe white nationalists, Klansmen, neo-Nazis as 'very fine people'; that has certainly contributed to the environment that we see in this country at this moment," said O'Rourke. "I think he's trying to play upon the worst impulses of this country instead of speaking to our ambitions, our hopes, our dreams, those things that we can achieve if we all come together."

While urging voters to challenge Trump's rhetoric and policies by turning out for "this defining midterm election," the congressman also responded to an audience member's question with criticism of Trump's frequent attacks on the media, which the president often calls "fake news."

"This idea fronted by the president that somehow the press are the enemy of the people, reinforced by him tweeting out images of a reporter being hit by a train, body-slammed in a wrestling ring, is incitement to violence. I don't know any other way to call it. That undermines an essential pillar of the American democracy," he said. "Nothing guarantees us a 243rd or a 244th year, unless all of us stand up for the institutions that make us so strong in the first place."

"So, I think we need to vigorously defend the freedom of the press," he continued. "We need to call out violations, not just in this country, in countries like Mexico, one of the most dangerous places to be a journalist, the killing of Khashoggi by the Saudi Arabian government. There has to be consequence. There has to be accountability. There has to be justice. This is our chance to lead on one of the most important issues to our democracy and to freedom around the world."

Watch: