Lawmakers agreed to fund the government through Feb. 8 after McConnell (R-Ky.) said he would address the status of young undocumented immigrants called "dreamers" who were brought to this country as children.
The pact came at a time when trust has been in short supply on Capitol Hill — and it unnerved liberal activists who weren't sure whether to believe McConnell.
McConnell delivered a carefully worded speech on the Senate floor, saying it was his "intention" to address the dreamer issue, whether in the next spending bill or thereafter. He did not offer a specific promise to protect dreamers, and he suggested that he would offer nothing if the government shut down again, but he said he would follow an evenhanded process.
Even if such a bill passed the Senate, it remained entirely unclear Monday how it would fare in the more conservative House.
But the deal was enough for 33 Senate Democrats, who joined 48 Republicans to break an impasse that cleared the way for federal agencies to reopen late Monday.
" 'Trust but verify' is my motto," said Sen. Angus King (Maine), an independent who caucuses with Democrats. "He's made this commitment publicly, he made it on the floor of the Senate. He was much more specific this morning than he was last night, and frankly this is an important opportunity for him to demonstrate that he will carry through."
Senate Minority Leader Charles E. Schumer (D-N.Y.) endorsed the plan, which also reauthorizes the Children's Health Insurance Program for six years and rolls back several health-care taxes.
On Monday evening, the House quickly passed it, sending it to Trump for his signature.
"I am pleased that Democrats in Congress have come to their senses," Trump said in a statement. He vowed to "work toward solving the problem of very unfair illegal immigration."
But for some Democrats, including senators, the day brought an unsatisfying conclusion to a risky gambit to force Republicans to help protect dreamers, whose futures were cast into doubt when Trump canceled an Obama-era program known as Deferred Action for Childhood Arrivals (DACA).
Some Democrats argued that McConnell had offered no new concessions on immigration. Others regretted giving up the leverage they believed they had in the government spending talks. Others said they simply didn't trust him — or his party — to follow through.
"He did not make a commitment," said Sen. Kamala D. Harris (Calif.), one of 16 Democrats who voted to block the bill.
Republicans didn't make those Democrats feel much better. Sen. Tom Cotton (R-Ark.), an immigration hard-liner, said he didn't think McConnell was making any more of a promise Monday than he had last week.
"He has not changed since Friday," Cotton said. "He has not changed since September."
Even Sen. Lindsey O. Graham (R-S.C.), a proponent of a DACA deal who helped negotiate Monday's vote, called into question whether anyone can trust anyone on Capitol Hill.
"Nobody trusts anybody around here," Graham said just before the vote. "And most Americans don't trust any of us."
Nonetheless, many Democrats and Republicans, including Graham, agreed that McConnell had given some ground in agreeing to pursue an immigration bill to address DACA that both sides could amend.
Some Democrats said they voted for the plan because they were growing antsy about continuing a shutdown with little optimism about resolving the immigration deadlock in the coming days.
"I just think our job is to make sure government works for people and their lives get better, and that's what I tried to do," said Sen. Joe Donnelly (D-Ind.), who had voted against the shutdown to begin with. "Our efforts helped bring the two leaders together, helped make sure that they talked and helped make sure that a deal got done."
Others did so because about a dozen Republicans had agreed to work with them on immigration policy. They said that since Democrats deeply mistrust McConnell, perhaps they could now gang up on him with the help of those skeptical Republicans.
"I'm not trusting in Mitch McConnell, I'm trusting in [Sen.] Susan Collins and these folks who've really gone out on a limb. We've got to start from somewhere," said Sen. Tammy Duckworth (D-Ill.), who voted for the spending bill Monday.
The deal, in the end, was to trade Democratic support for reopening the government for a commitment by Republicans to address the status of young undocumented immigrants in February, if not sooner.
Sens. Collins (R-Maine), Jeff Flake (R-Ariz.) and Graham helped broker the agreement, with Flake and Graham shuttling between huddles with McConnell and Schumer for much of the weekend.
During bipartisan meetings in Collins's office, senators used a device most commonly found in elementary school classrooms — a talking stick — to avoid unproductive crosstalk. They eventually switched to a basketball, according to Sen. Joe Manchin III (D-W.Va.), because it was easier to toss back and forth.
After the vote, some liberal activists and lawmakers fired off news releases slamming the arrangement. One called it a "vague promise." Another labeled it a "fingers-crossed bargain."
Angel Padilla, policy director of Indivisible, a group that promotes liberal grass-roots advocacy, wondered why Democrats were taking McConnell at his word.
"For months, Democratic leadership has reassured Dreamers that Democrats would use all their leverage to get the Dream Act done," Padilla lamented in a statement Monday. "Indivisible groups will be paying attention and will remember who follows through on their commitments to Dreamers today."
Trust between Republicans and Democrats has been eroding rapidly in recent weeks and months.
After Sen. Richard J. Durbin (D-Ill.) confirmed that Trump had referred to Haiti and African nations as "shithole countries" in a recent Oval Office meeting with lawmakers, Cotton and Sen. David Perdue (R-Ga.), who were also in the meeting, disputed his account.
Intraparty tensions have also been on the rise. Graham has grown frustrated with Cotton and White House senior adviser Stephen Miller, who hold harder-line views on immigration and border security. Cotton and the White House have hit back against Graham.
Further complicating matters, lawmakers are still unclear about what kind of immigration bill Trump wants to sign. He has offered mixed signals about whether he would back a measure akin to what centrist Republicans and Democrats favor, leaving some lawmakers not to trust his word, either.
Even McConnell suggested uncertainty, during last week's negotiations, about what the president would do.
"What I want to see is an outcome, and an outcome involves the signature of the president of the United States," McConnell said. "So what I'm waiting for in terms of making a decision about floor time is, are we dealing with an issue that has a chance to become law?"
The agreement reached Monday merely set the parameters of a debate and did not specify the substance of any potential legislation, leaving the fate of the immigration issue just as unclear as before.
Multiple proposals to address the legal status of dreamers have been introduced by Democrats and Republicans over the past year, including the Dream Act, which would create ways for more than 1 million eligible dreamers to apply for citizenship. Other versions of the bill would shrink the pool of eligibility.
With the negotiations focused on the Senate, Trump remained on the sidelines for much of the past few days, intermittently interjecting on Twitter to criticize Democrats and press Republicans to change the rules of the Senate to make it easier to pass their bill if the standoff was not quickly resolved.
The three-day stalemate exposed a growing rift between two groups of Democratic senators: those facing tough reelection campaigns in states Trump won and those courting liberal voters ahead of possible 2020 presidential bids.
In addition to Harris, other potential White House contenders who voted against the bill included Sens. Bernie Sanders (I-Vt.), Kirsten Gillibrand (D-N.Y.), Elizabeth Warren (D-Mass.) and Cory Booker (D-N.J.).
The vote on final passage in the Senate vote was 81 to 18. Two Republicans, Sens. Rand Paul (Ky.) and Mike Lee (Utah), voted no. In the House, the measure passed 266 to 150.
Lawmakers in both chambers and the White House still have to hash out a longer-term deal on military and domestic spending over the next few weeks, as they face yet another cliff on Feb. 8.
Ahead of the vote to end the debate, Schumer warned McConnell to keep his word.
"I expect the majority leader to fulfill his commitment to the Senate, to me and to the bipartisan group, and abide by this agreement. If he does not . . . he will have breached the trust of not only the Democratic senators but members of his own party as well," Schumer said.
Robert Costa, Erica Werner and Paul Kane contributed to this report.