Sen. Ted Cruz, R-Texas, mocked Rep. Beto O'Rourke, D-Texas, for dodging questions Tuesday night about what the federal government should do to boost border security, and said the Democrat trying to win his Senate seat would prefer to tear down barriers that keep Americans safe.

The two Texas lawmakers faced off in San Antonio, where O'Rourke was asked what border security measures he would try to impose short of the border wall that he opposes. But O'Rourke replied by saying only that he has worked to boost security at official ports of entry, not outside those ports where illegal immigrants routinely try to cross.

"That's where more than 90 percent of everyone and everything that ever comes into the United States first crosses," he said of legal U.S. ports of entry. "Having a better idea of who and what comes into our country demonstrably makes us safer, and at the same time, those customs officers are able to facilitate legitimate trade and travel that's connected to more than 1 million jobs in the state of Texas."

[Opinion: A merit-based argument for making immigration great again]

But Cruz said his answer dodged the heart of the question.

"Everyone should notice in his answer that he wanted to talk about trade, he wanted to talk about customs, he wanted to talk about everything except border security," Cruz said, noting that law enforcement is backing his own campaign, not O'Rourke's.

"Congressman O'Rourke not only opposes a wall, but he has said we have too many fences and walls already on the border, he wants to tear down the ones we have," Cruz said.

When asked again by the moderator how he would boost border security aside from a border wall, O'Rourke again said he has worked to beef up official ports of entry.

"As I just told you, Sen. John Cornyn and I have worked to invest in our ports of entry," O'Rourke said. He then argued that Congress should take steps to help the Dreamers, who are immigrants who entered the country illegally at a young age with their parents.

"We cannot use this idea of border security to be an impediment to moving forward on those issues that are also demanding our action, and which Texans know better than perhaps any other people of any other state," O'Rourke said. "On issues of immigration reform, the fate of Dreamers, more than 200,000 in the state of Texas."

Cruz has been holding onto a lead of about 9 points in some of the latest polls on the race.