DALLAS (CBSDFW.COM/AP) — It was a heated first Texas Senate debate Friday between between Sen. Ted Cruz and Rep. Beto O’Rourke in Dallas as they tackled numerous topics that included immigration, guns and President Donald Trump.

Cruz went on the attack moments after stepping on the stage, charging that his opponent suggested that police officers embodied “modern-day Jim Crow” laws in response to a question about a Dallas policewoman who shot and killed her unarmed, neighbor after mistakenly entering his apartment, thinking it was her own.

O’Rourke responded that the accusation was “simply not true.” Cruz appeared to be referring to O’Rourke previously suggesting that inherent biases in the criminal justice system promote racism.

debate1 Cruz, ORourke Talk Immigration, Guns, Trump In Heated 1st Texas Senate Debate

Sen. Ted Cruz (R-TX) and Rep. Beto O’Rourke (D-TX) shake hands after a debate at McFarlin Auditorium at SMU on September 21, 2018 in Dallas, Texas. (Photo by Tom Fox-Pool/Getty Images)

Later, when Cruz tried to say O’Rourke wanted to abolish the Second Amendment, the Democrat said it wasn’t so, and the candidates sniped while the moderators pleaded for them to stop and for the audience to stop hooting. O’Rourke said Texas was ready for a senator who will protect the Second Amendment while imposing small restrictions to save lives and prevent mass shootings. He suggested those were supported by “gunowners and non-gunowners alike,” but when he said the common GOP refrain after gun violence of offering “thoughts and prayers” wasn’t enough, Cruz bristled.

“Thoughts and prayers Sen. Cruz are just not going to cut it anymore. The people of Texas, the children of Texas deserve action,” said O’Rourke

“More armed police officers in our schools is not thoughts and prayers. I’m sorry you don’t like thoughts and prayers,” Cruz said. “I will pray for anyone in harm’s way, but I’ll also do something about.”

The first question of the debate was regarding the topic of immigration. O’Rourke said he believes Dreamers should be free from the threat of deportation and for them to become U.S. citizens. Cruz responded by saying he believes legal immigration is good for America while illegal immigration is bad.

On the topic of President Trump, Cruz said O’Rourke wants to impeach the president. The Democrat responded by saying he would work with anyone at anytime, including the president.

Cruz was also asked whether Supreme Court nominee Brett Kavanaugh’s accuser could say anything that might make him question his support for the nomination. Cruz said “absolutely,” but didn’t elaborate while calling the allegations serious.

Democrats have long dreamed of flipping heavily Hispanic Texas, the country’s largest red state, and transforming the national electoral map. O’Rourke is giving up his El Paso-based U.S. House seat to try and upset Cruz, even though his party hasn’t won any of Texas’ two dozen-plus statewide office races since 1994, America’s longest political losing streak.

The debate at Dallas’ Southern Methodist University also saw Cruz criticize O’Rourke’s past support for legalizing marijuana, evoking his older half-sister, Miriam, who died of a drug overdose. O’Rourke, meanwhile, has been open about his 1998 arrest for drunken driving in El Paso, but said for the first time Friday that he did not try to flee the scene, as a witness suggested in the police report. He called the incident a “terrible mistake”

The pair will square off again next weekend in Cruz’s hometown of Houston, and a third and final debate is set for San Antonio three weeks before the Nov. 6 election.

Cruz didn’t speak to the media afterward except to say he thought the debate “went great.” But O’Rourke said the senator “has a tendency to mischaracterize a position.”

“If he’s talking about NFL players kneeling during the national anthem at a football game to call attention to injustice in this country, he’ll talk about flag burning,” O’Rourke said. “If we’re talking about ending the war on drugs, the war on people, and some people over other people in this country, and ending the prohibition on marijuana, he’ll talk about legalizing heroin and cocaine. No one wants to do any of that.”

O’Rourke visited all 254 Texas counties, including areas that Democrats long ago gave up on — a fact he mentioned repeatedly during the debate. Cruz dismissed many such visits as photo-ops.

Cruz finished second in the 2016 Republican presidential primary. But a variety of polls show that O’Rourke is staying within striking distance — prompting Cruz to go negative in ads lately, attacking his opponent for defending NFL players’ right to protest during the national anthem and his opposition to the Trump administration’s hardline stance on immigration.

President Trump announced that he’ll rally in Texas for his once bitter rival Cruz next month — previously unthinkable in a state where Republicans usually rack up landslide victories.

A truck mounted with a portable billboard of a February 2016 Trump tweet declaring, “Why would the people of Texas support Ted Cruz when he has accomplished nothing for them?” was parked near Friday’s debate site. It’s frequently hit Texas political events since Trump announced plans to visit.

Asked Friday about Trump’s 2016 criticism, which included making fun of Cruz’s wife’s appearance and suggesting that his Cuban-born father had a hand in the assassination of John F. Kennedy, Cruz said, “I could have chosen to make it about myself,” but instead he said he worked with Trump to further Texas interests.

That ignored Cruz drawing the ire of many Texas conservatives for refusing to endorse Trump during the 2016 Republican National Convention. He eventually supported his party’s candidate, though.

O’Rourke criticized Cruz during the debate for failing to rebuke Trump administration tariffs against China, which he said would hurt Texas trade interests.

Things are likely to stay nasty in coming weeks.

Asked what he admired about O’Rourke, Cruz managed to compare him to Sen. Bernie Sanders of Vermont. O’Rourke drew laughs by replying simply of Cruz: “True to form.”

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)