WASHINGTON — Senate Majority Leader Mitch McConnell, generally seen as a master congressional deal-maker, walked into a legislative dead end on domestic surveillance that left some of his friends bewildered.

The Kentucky Republican had repeatedly insisted on continuing the government's bulk collection of Americans' phone data. That put him at odds with the Obama administration and the Republican-run House, which overwhelmingly endorsed significant limits.

Senators say McConnell overestimated his ability to force a deadline-driven extension, and seemed to misjudge the bipartisan support for the House-crafted changes.

Most puzzling to some were the veteran lawmaker's actions that allowed a first-term senator — his GOP colleague from Kentucky, Rand Paul — to use the Senate's elaborate rules to delay things long enough to cause the entire USA Patriot Act to lapse for a couple of days, starting at midnight Sunday.

As Democrats heaped scorn on McConnell, even some allies said they didn't understand what end game he had in mind.

"I don't know. I just don't," said Sen. Susan Collins, R-Maine.

"You'll have to ask him," said Sen. Thad Cochran, R-Miss.

Following the September 2001 terrorist attacks, Congress enacted the Patriot Act to improve detection of potential terrorism. Particularly controversial, once it came to light in 2013, was the National Security Agency's massive gathering of phone records. The actual conversations were not captured.

The House voted overwhelmingly this year to end the bulk collection, and to require the government to obtain court orders to pursue specific phone records. The Senate concurred Tuesday, but only after a protracted battle that left McConnell at odds with many Republicans. Obama signed the bill into law Tuesday night.

"I don't know why McConnell got in the way of this. It just doesn't make sense to me," said Rep. Bill Flores, a senior House Republican from Texas.

The issue put a spotlight on the strained relationship between Kentucky's nationally prominent senators. Paul, whose father was a libertarian hero from Texas, vaulted to the Senate in 2010 by defeating McConnell's choice for the seat. But Paul endorsed McConnell's tightly contested 2014 re-election bid, and McConnell returned the favor by endorsing Paul's 2016 presidential campaign.

Tensions between the two men ran high in an unusual Sunday Senate session. McConnell failed to persuade Paul to allow a short-term extension of the Patriot Act or a quick approval of the House bill.

"I forced the expiration of the NSA's illegal spying program," Paul boasted in a campaign fundraising e-mail.

Asked Tuesday if the nation would be safer, or less safe, with Paul as president, McConnell demurred. "You're trying to get me to make a derogatory comment about members of the Senate," he said. "I'm not going to do that. I admire and respect them all."

Senators in both parties said the Patriot Act lapse could have been avoided if McConnell had let the debate play out a few weeks earlier. "Senate Republicans wasted precious time as the clock ran out on key national security authority," said Democratic Sen. Dick Durbin of Illinois.

In a final setback Tuesday, the Senate rejected McConnell's bid to amend the House bill and force fairly minor concessions. Democrats said he was trying to save face.

McConnell gave a defiant speech, just before the final votes, attacking President Barack Obama's handling of foreign policy. "The president's efforts to dismantle our counterterrorism tools have not only been inflexible, they are especially ill-timed," he said.

While some Republicans privately groused that McConnell mishandled the surveillance issue and made it easy for Democrats to deride them, they did not suggest his leadership was damaged. And some openly defended him.

The Patriot Act lapsed "because Rand Paul refused to let the Senate function," said Sen. Richard Burr, R-N.C. "I don't think it's in any way, shape or form on Mitch McConnell's shoulders."

McConnell laughed when a reporter asked if the surveillance battle damaged his leadership. "We had a divided conference on this," he said. "We knew that from the beginning, and it won't be the last time."

McConnell's handling of the surveillance issue contrasted with his savvy, behind-the-scenes maneuvering in many other matters over his 31-year Senate career. For instance, McConnell and Vice President Joe Biden negotiated a difficult end to the "fiscal cliff" tax-and-spending crisis in the first hours of 2013.

Some Republicans on Tuesday seemed eager to put the surveillance debate behind them, and to give McConnell a break. "It was a busy month," said Sen. Lamar Alexander, R-Tenn., pointing to a major trade bill and other legislation the Senate handled. "We just ran out of time."

But GOP Sen. Mike Lee of Utah was less forgiving. Congress knew for years that the Patriot Act would expire, he said in a speech Tuesday, and the Senate should have resolved the matter "long before now."

Associated Press writer David Espo contributed to this report.