Republican Texas Sen. Ted Cruz and Democratic congressman Beto O’Rourke met Friday night at Southern Methodist University in Dallas in the first debate of three scheduled prior to the Nov. 6 vote over Cruz's seat.

In a substantive but often contentious back-and-forth, the two men tackled a variety of issues ranging from immigration to the Supreme Court to their perspectives on working with President Trump.

“I have worked hand in hand with the president on substance and we’ve delivered victories,” Cruz, who lost the GOP presidential nomination to Trump in 2016, explained when asked about working with the president post-loss. “Texans lives are better. I could have chosen to make it about myself but I think that would’ve been not doing the job I’ve been elected to.”

O’Rourke responded by slamming Trump, specifying the president’s criticisms of FBI and Justice Department officials. “When the president attacks our institutions, that is our business,” he argued. “We are still a nation of laws and not one of men.”

“This state needs a senator who will work with the president when he can and stand up to him when we must,” O'Rourke stated.

TEXAS SENATE SEAT COMPETITIVE BATTLE BETWEEN CRUZ, O'ROURKE: A LOOK AT THE CANDIDATES

Asked for their perspective on the immigration debate, both men provided pithy answers. “My views on immigration are simple,” Cruz said, adding that it boiled down to four words: “Legal, good. Illegal, bad.” The senator argued for doing “everything possible to securing the border.”

“We can do all of that,” he said, “at the same time we are celebrating legal immigration.”

O’Rourke, however, said that “we need to bring people out of the shadows.”

“And yes,” he said, “there should be an earned path to citizenship.”

Cruz and O’Rourke later spoke about gun violence, with the former strongly reiterating his support for the Second Amendment. But, Cruz argued, recent school shootings were symptomatic of deeper issues. “There is something deeply wrong that we have these shootings,” he said, pointing to the “removing of God from the public square” and “losing the binds of community and family.”

O’Rourke hit Cruz back forcefully, however, advocating for gun control.

“Thoughts and prayers are just not going to cut it,” he argued to jeers from those in attendance.

Cruz on Friday night was also asked whether Christine Blasey Ford, who has accused Supreme Court nominee Brett Kavanaugh of a youthful sexual assault, could say anything that might question his support. Cruz said "absolutely," but didn't elaborate while calling the allegations serious.

"Dr. Ford's allegations should be investigated by the FBI – full stop," O'Rourke argued, adding that "we need a Supreme Court justice that will decide in favor of people ... and in Brett Kavanaugh we do not have that."

Broadening their arguments just weeks from Election Day, Cruz claimed that "Congressman O'Rourke's positions are out of step with the people of Texas. If he's elected, he will fight to raise your taxes." But the congressman said Cruz is working for "the special interests ... He's not working for the people of Texas."

National attention in the race has grown as O'Rourke has raised more money than Cruz. And polls have suggested a tighter race than expected in a state where Republicans typically win handily.

The next debate is scheduled for Sept. 30 at the University of Houston with the final encounter set for Oct. 16. Early voting in Texas runs from Oct. 22 to Nov. 2.