Sen. Ted Cruz, R-Texas, joked Tuesday that his Democratic opponent, Rep. Beto O’Rourke, should join former Democratic presidential candidate Hillary Clinton in jail.

While speaking at Sun City, an age-restricted community in Georgetown, Texas, someone yelled for O’Rourke to be locked up.

"Well, you know, there's a double-occupancy cell with Hillary Clinton,” Cruz said, according to multiple Texas reporters, and his comment was met with applause. "Y'all are gonna get me in trouble with that."

[Also read: The Trump-Cruz insults you won't hear at the rally]

The audience member who yelled, “Lock him up,” was mimicking calls from President Trump’s campaign rallies, where crowds chant, “Lock her up,” referencing his former opponent.

O’Rourke and Cruz are in a tight race for the 2018 midterm elections to represent Texas in the Senate. Earlier this month, a New York Times poll had Cruz 8 percent ahead of O’Rourke at 51 percent, but 5 percent of voters were still undecided.

Texas has not voted a Democrat into statewide office in almost 15 years.

Cruz came in second to Trump in the Republican general elections in the 2016 race for the White House, meaning a defeat in the 2018 midterm elections would be a big deal, especially in a red state like Texas.

[Opinion: Why Beto O'Rourke is going to lose, in one photo]