HOUSTON — It took nearly two hours, dozens of air balls and rim shots, a few rounds of political trash talk and one desperately needed reduction in the score required to win — but they did it.

Ted Cruz and Jimmy Kimmel completed their much-hyped one-on-one basketball game Saturday evening before thousands at Texas Southern University — and the Texas senator came out on top, defeating the late-night TV host 11-9. It was a grueling, slow-moving affair that finally ended with Cruz, who kept a small lead for most of the game, sinking a jump shot from the wing.

“You’re a good sport,” Kimmel told Cruz in defeat. “I still think you’re a terrible senator.”

The game, which will air Monday night on Kimmel’s show, was deemed the Blobfish Basketball Classic, named after the creature Kimmel compared Cruz to last month after Cruz tweeted a picture of himself at the Houston Rockets’ Game 7 against the Golden State Warriors in the NBA's Western Conference finals. The Rockets lost, Kimmel laid on the ridicule and Cruz challenged him to the game to stick up for his hometown team.

The two had originally agreed to donate $5,000 to a charity of the other’s choice if they lost. Cruz picked Generation One Texas, which fights poverty, and Kimmel selected the Texas Children’s Hospital. They each ended up promising to give $10,000 to both charities.

Both players were well aware of the lackluster talent on display. At one point in the first half, Kimmel offered to “apologize to the game of basketball,” and he repeatedly joked he would require a trip to the hospital before the game was over. With the match at 5-5 and no end in sight, Kimmel announced they had struck a compromise “in the spirit of bipartisanship” to lower the score needed to win from 15 to 11.

Kimmel, a Democrat, didn’t leave his politics at the door for the half-court showdown, raising a few policy issues with the conservative firebrand while they were checking the ball. In one of their lengthier exchanges, Kimmel appeared to question Cruz about his support for insurance protections for people with pre-existing conditions, and Cruz’s response drew loud boos and ultimately chants of “Beto!” — the first name of the El Paso congressman challenging Cruz in his bid for re-election.

“I figure this is the closest we’re gonna get to a town hall,” Kimmel went on to say.

In another round of trash talk that touched on current events, Kimmel referenced the raging debate over President Donald Trump's policy of separating children from their parents after they illegally cross the border. "Did you spend more time this week practicing basketball than trying to get those kids out of that detention center?" Kimmel asked Cruz.

The game featured a healthy amount of Cruz mockery from the get-go. After a singer finished the National Anthem, he took off his American flag shirt to reveal one with a Canadian maple leaf and began belting out the Canadian National Anthem — a nod to Cruz’s birthplace. The senator took it in stride, pulling out a hockey stick and Canadian beer.

Kimmel also jabbed Cruz over his bitter history with Trump, who beat Cruz in the 2016 GOP presidential primary after a protracted battle.

“You got to see your daddy win something,” Kimmel told one of Cruz’s daughters after the game.

Speaking post-game with reporters, Cruz said he would do it again “in a heartbeat — although we did promise ESPN never again for the sake of basketball.” A reporter noted Cruz was stronger going right than left to the basket. “Does that surprise you?” Cruz asked.

ABC U.S. Sen. Ted Cruz, R-Texas, prepares to shoot in his one-on-one basketball game against late-night TV host Jimmy Kimmel. The two faced off Saturday in Houston to benefit charity.

Cruz’s circle saw the game as an opportunity to put him in a humanizing light and show that he could take a joke. It did not hurt that Cruz is up for re-election this fall and faces a well-funded challenge from Beto O’Rourke, who shrugged off the basketball-fueled spotlight on Cruz when a woman offered O’Rourke her ticket this week at a town hall.

“Let’s let them have their basketball game,” O’Rourke said, suggesting Kimmel at least wear a Beto for Texas shirt. (He did not.) “And let’s go out there and win this election.”

O’Rourke, for his part, was spending the weekend planning a Sunday morning march to the border town of Tornillo to raise awareness for a tent camp being used to house immigrant children. It was a welcome contrast to O’Rourke’s supporters, who also noted Cruz had found the time to play basketball against Kimmel but not responded yet to O’Rourke’s challenge to six debates.

Cruz, speaking earlier Saturday with reporters in San Antonio, said he is happy to debate O’Rourke “closer to the election when people are focused more closely on it.” Asked how he would have reacted if David Dewhurst, his heavily favored opponent in the 2012 Senate race, blew him off for a game of basketball with Kimmel rather than answer his debate challenge, Cruz responded jokingly.

“Well, you know, Dewhurst is a tall guy,” Cruz said. “He might have been able to beat Kimmel in basketball.”