Donald Trump on Friday signed into law the largest economic stimulus package in US history, a bill designed to rush federal assistance to workers and businesses as the coronavirus pandemic devastates the economy and healthcare system.

Congress acted with unprecedented speed and bipartisanship in a moment of national crisis, negotiating the $2.2tn bill over several days in an urgent effort.

“We got hit by the invisible enemy and we got hit hard,” the president said at a White House signing ceremony.

Remarking on the sheer scale of the package, he said: “I never signed anything with a ‘T’ on it.”

Earlier, the House approved the package by voice vote, after leaders in both parties united to overcome a Republican’s last-minute attempt to delay its passage.

Thomas Massie, of Kentucky, attempted to use a procedural maneuver to force a recorded vote and require lawmakers to vote individually. He was overruled by a unanimous show of force, House leaders seeking to avoid a recorded vote so lawmakers would not be forced to return to Washington. The last-minute drama brought strong bipartisan criticism of Massie, from the White House down.

The legislation will deliver one-time direct payments of $1,200 to most taxpayers and substantially enhance unemployment benefits. The measure also creates a $500bn lending program for businesses, cities and states and a $367bn fund for small businesses.

The US has surpassed China and Italy in the number of confirmed coronavirus cases and a record 3.3 million Americans have filed for unemployment. The Senate approved the measure in an extraordinary 96-0 vote on Wednesday night.

Earlier on Friday, Trump berated Massie, calling him a “third rate Grandstander” and “a disaster for America, and for the Great State of Kentucky!”

“He just wants the publicity. He can’t stop it, only delay, which is both dangerous … & costly,” Trump wrote. “Workers & small businesses need money now in order to survive.”

Trump also heaped praise on former secretary of state John Kerry, a frequent target of his wrath, for a tweet claiming Massie “tested positive for being an asshole”.

In a series of 11 tweets, Massie, a libertarian member of the ultraconservative House Freedom Caucus, explained his rationale.

“The constitution requires that a quorum of members be present to conduct business in the House,” he said.

“Right now, millions of essential, working-class Americans are still required to go to work during this pandemic such as manufacturing line workers, healthcare professionals, pilots, grocery clerks, cooks/chefs, delivery drivers, auto mechanics and janitors (to name just a few). Is it too much to ask that the House do its job, just like the Senate did?”

A memo from the sergeant-at-arms, Paul Irving, and the House attending physician, Brian Monahan, suggested members of the chamber whose ages span from 30 to 86 consider staying home. In bolded and underlined text, they wrote: “Members should use extreme care and deliberation when making the determination to travel to Washington DC.

Earlier, Massie dismissed concerns about legislators having to fly back to Washington, noting he chose to drive and suggesting stranded colleagues might “hitch a ride with a trucker”.

His colleagues were furious. At least two House members have tested positive for coronavirus, while a number of others are awaiting test results or in quarantine after coming into contact with an infected person.

“If you intend to delay passage of the coronavirus relief bill tomorrow morning, please advise your 428 colleagues RIGHT NOW so we can book flights and expend [more than] $200,000 in taxpayer money to counter your principled but terribly misguided stunt,” the Minnesota congressman Dean Phillips tweeted late on Thursday.

The Republican Fred Upton, of Michigan, drove nearly 10 hours to “help get this thing over the finish line”. Several lawmakers from western states said they would fly in.

“Getting on a red eye,” the California congressman Mike Levin tweeted. “Too much is at stake and Americans can’t afford to wait any longer.”

“I am jumping on the red eye tonight,” the Arizona congressman Ruben Gallego, a Democrat, tweeted. “Thanks Massie.”

​As the crisis deepened across the country, with the US death toll rising to more than 1,200, lawmakers shared a sense of urgency. In more than three hours of debate, which began on Friday morning and was split evenly between Republicans and Democrats, lawmakers made impassioned pleas for their communities.

Congresswoman Haley Steves, a freshman Democrat from Michigan who drove through the night to get to Washington,wore pink latex gloves to emphasize the risks faced by medical professionals combatting the virus.

When her speaking time had expired, Stevens, whose district outside Detroit has been devastated by the spread of the disease and the economic fallout, began to shout over the chairman as he ruled her out of order.

“I rise for every American who is scared right now,​” she shouted, holding her gloves in the air as the presiding chair banged the gavel and other members joined the fray.

“You will see darkness! You will be pushed,” she said.

​Moments later the New York congresswoman Alexandria Ocasio-Cortez, whose state is at the center of the outbreak, delivered an impassioned speech on the shortcomings of the bill.

“What did the Senate majority fight for?​” she said, her arms punching the air in fury.​ “One of the largest corporate bailouts with as few strings as possible in American history. Shameful!”

A surreal scene today.



Legislating during #COVID19. pic.twitter.com/5OuBf7Rl4P — Congresswoman Mary Gay Scanlon (@RepMGS) March 27, 2020

As the debate came to a close, the House speaker, Nancy Pelosi, asked lawmakers to assemble on the House floor and in the galleries above, typically reserved for the public, in order to ensure social distancing.

When it was time to vote, a resounding “Yea” echoed throughout the chamber. Massie was among a handful of discordant “Nos”.

“I came here to make sure our republic doesn’t die by unanimous consent,” he said, demanding a roll call vote. With at least the 216 required lawmakers present, the gavel cracked and the legislation cleared the chamber.