Legislators raced to salvage a $1.1 billion package of construction projects Thursday night after it nearly came apart over a last-minute funding problem with a water pipeline project in southwestern Minnesota.

The Minnesota House was debating the statewide borrowing measure at the time this edition went to press, but passage seemed assured both there and in the Senate. The bill will make multimillion-dollar investments in new higher education science facilities, affordable housing and other amenities around the state.

The snag that triggered a frantic round of deal-making surfaced late Wednesday night as negotiators were finishing up a proposal for $22 million in bonds for the Lewis and Clark Regional Water System, a multistate project to pipe water to a handful of perpetually dry southwestern Minnesota communities.

The project is a tiny slice of the overall spending package, but has taken on outsized political significance at the Capitol, in part because much of the area is represented by Republicans, whose votes were needed to build the supermajority required for passage. DFL Gov. Mark Dayton prominently featured the project in his State of the State speech and the measure has been at the forefront of negotiations over the borrowing plan.

Late on Wednesday night, lawmakers discovered that the project might not qualify under the rules of statewide borrowing and it might not get settled anytime soon.

"We'd never heard of anything like that before," said state Rep. Alice Hausman, a veteran St. Paul DFLer and chairwoman of the capital investment committee.

With time rapidly running out in the session, which is scheduled to end Monday, Hausman and others agreed to use cash for that portion of the project.

The problem came when Republicans wanted a larger share of the $69 million pipeline project included in the plan. DFLer said they could not cut enough other projects from the $200 million cash portion to fit in more of the project.

That resulted in a late-night conference call with local officials in the Luverne and Worthington areas needing the water to see if more could be done.

Working late into the night, legislative staffers devised a novel solution: Local communities would borrow money on their own to pay for the remainder of the project and the state would increase its aid to the communities to cover a share of the additional debt.

"That was huge, huge," Hausman said. "Now, the locals can go full speed ahead and don't have to wait for it piece by piece."

Rep. Joe Schomacker, R-Luverne, proclaimed himself thrilled with the solution.

"I'll vote for it a couple times if there is an agreement," said Schomacker, who said his re-election could be imperiled if he returned to his district without the project.

Nighttime horse-trading

But that was not enough to win all eight of the Republican House votes needed for the supermajority.

Over Wednesday night and into Thursday morning, Republican members came forward with projects they wanted in exchange for their votes. DFLers, who control the House, were forced to pare back other projects to make room for the new spending Republicans wanted.

They added money for a community center in Cosmos at the request of Rep. Dean Urdahl, R-Grove City. They also added more money for a clean-water initiative in Lake Elmo.

The bartering continued until the very end.

"I just get nervous because I have cut a lot of Democrats," Hausman said. "At a certain point, you have to be fair to everyone."

The final measure includes about $1.17 billion in spending, with about $846 million coming from state-backed debt. The rest is cash and other forms of borrowing.

The construction package includes countless relatively tiny allotments that lack the attention-grabbing appeal of new science buildings but are hugely important to their local communities.

Legislators set aside $200,000 for a small roads and sewers project in Sandstone, pop. 2,770. But that little bit of seed money will usher in a new $30 million hospital complex.

"It's huge as far as the quality of medical care that people will get," said Rep. Tim Faust, DFL-Hinckley. "But it is also big as far as the employment during construction and once the hospital is built."