Sen. John Cornyn gave a farewell speech on the Senate floor Thursday, telling his colleagues, "Do right and risk the consequences." He borrowed the phrase from Sam Houston, a former Texas senator, and said he keeps a picture of Houston above his desk.

Cornyn has served 24 years in the Senate. He lost the Republican primary for reelection to Ken Paxton. Paxton later lost the November general election to Democrat James Talarico, who will take Cornyn's seat in January.

In his remarks, Cornyn defended bipartisan gun legislation passed after the mass shootings in Sutherland Springs and Uvalde. He said the measures closed gaps in the background check system and invested in mental health and school safety while protecting Second Amendment rights. "I believe our bipartisan work has saved lives," he said.

Cornyn also called for difficult decisions on the national debt and said the Senate still needs members willing to work together. "We're temporary occupants of these seats," he said, adding that senators should leave their seats "a little bit better than where we found it."