(CNN) Seven months after former President Barack Obama was sworn in for his second term, House Republicans, with a shove from Sen. Ted Cruz, faced down the White House with an ultimatum: Sign off on legislation that delays or defunds the Affordable Care Act or risk a government shutdown.

Obama refused, unsurprisingly, to cut the legs out from under the law he'd spent the first year of his presidency -- and all the political capital that came with it -- selling to lawmakers on Capitol Hill, including dozens of Democrats who would lose their seats in part because of their support for the controversial overhaul.

In the end, the shutdown lasted 16 days -- the longest and most costly in American history. And for almost all of them, future President Donald Trump was tweeting and talking, keeping up a drumbeat urging Republicans to stick together and do everything in their power to stop Obamacare, while skewering Obama as a weak leader and incompetent negotiator.

Cheering on the Republicans

In the weeks leading up to the shutdown , the Republican-held House passed a bill that would have cut funding for the health care law while keeping the government open through December 15. The Democratic-held Senate rejected the House legislation, but not before Cruz launched a lengthy Senate floor filibuster of the vote. On September 27, the Senate passed the House bill -- minus the Obamacare defunding bit.

Days later, the House approved another bill, this one delaying the law by a year. The two chambers would go back-and-forth a few more times, but the impasse remained. On Tuesday morning, October 1, the shutdown began.

.@RNC leadership should not be afraid of a government shutdown. They should be afraid of not defunding ObamaCare. — Donald J. Trump (@realDonaldTrump) September 18, 2013

Congratulations to @SpeakerBoehner on standing strong and tying government shutdown to defunding ObamaCare. — Donald J. Trump (@realDonaldTrump) September 20, 2013

Republicans must unite to defund Obamacare - it will drive our country into oblivion and, by the way, the healthcare is no good anyway! — Donald J. Trump (@realDonaldTrump) September 21, 2013

Americans nationwide have their premiums double and work hours decreased. @GOP must do the right thing, stand strong & defund! — Donald J. Trump (@realDonaldTrump) September 23, 2013

It's a shame the ruling class of Republicans don't attack Obama and the Democrats the way they hit Senators Cruz & Lee. — Donald J. Trump (@realDonaldTrump) September 24, 2013

Our country needs leadership now. There is total dysfunction in Washington. — Donald J. Trump (@realDonaldTrump) September 27, 2013

No one wants the government to shut down, but if ObamaCare is fully implemented then our country will eventually shutdown anyway! — Donald J. Trump (@realDonaldTrump) September 30, 2013

Play-by-play of the shutdown

The Republicans can absolutely win if they stick together-but they are NOT sticking together. Sen. McCain just said "we can't win".Very bad! — Donald J. Trump (@realDonaldTrump) October 1, 2013

Obama has not passed a single budget in 4 years. Democrats don't even vote them in Congress. He has failed to lead! — Donald J. Trump (@realDonaldTrump) October 1, 2013

Obama & the Democrats want this shutdown. They think it helps their electoral prospects for 2014. Don't believe! — Donald J. Trump (@realDonaldTrump) October 1, 2013

"@jj10471 @realDonaldTrump if you were in office this would of never happen #trump2016" True! — Donald J. Trump (@realDonaldTrump) October 1, 2013

There have been 17 shutdowns since 1976, 14 under Reagan and Bush with Democrat Congresses who wanted more spending. — Donald J. Trump (@realDonaldTrump) October 1, 2013

It is crucial for Republicans to remain united during this shutdown — Donald J. Trump (@realDonaldTrump) October 1, 2013

'Moderate' Repubs plotting against @GOP strategy have short term memories. Tea Party gave them majority in House & primaries aren't fun. — Donald J. Trump (@realDonaldTrump) October 3, 2013

The Obama Administration has a very important duty to provide a budget - and then negotiate! OUR COUNTRY is a laughingstock! — Donald J. Trump (@realDonaldTrump) October 7, 2013

.@GOP has leverage. Must stay united & on message. — Donald J. Trump (@realDonaldTrump) October 8, 2013

Obama's job approval is at 37%, a record low. @GOP & @SpeakerBoehner have the leverage & momentum. Delay ObamaCare for all Americans! — Donald J. Trump (@realDonaldTrump) October 10, 2013

On October 11 , Trump appeared on CNN for an interview with Piers Morgan.

First he offered Obama some advice.

"I mean you just have a President that is not leading and not getting people into a room and not shouting, and cajoling, and laughing, and having a good time, and having a terrible time," he said. "But, you know, all of these different emotions are things you have to do but you have to get people in a room and you have to just make deals for the good of the country."

Trump, of course, has held at least a couple of bipartisan meetings -- for better or much, much worse

Asked about the tea party and Cruz, who agitated for the House to hold up funding, Trump praised their tactics.

"I'm a believer in the tea party, because what they want is what's really right for this country," he said. "They want something to be done about this horrendous debt, something to be done about a lot of different things going on in the country. I mean our country is in a free fall and these are good American people. These are great American people."

Trump also pushed for a more comprehensive agreement than was being discussed at the time.

"Now, maybe as we're speaking, they're going to make a deal where they do some kind of an extension, but an extension is not what you need," he told Morgan. "You need the overall deal. We have to make a big deal and it has to be the proper deal for the country."

Republicans seem intent on negotiating against themselves. Many senior Senators are doing Obama's bidding. Can't win this way. — Donald J. Trump (@realDonaldTrump) October 15, 2013

"Now, maybe as we're speaking, they're going to make a deal where they do some kind of an extension, but an extension is not what you need," he told Morgan. "You need the overall deal. We have to make a big deal and it has to be the proper deal for the country."

Endgame

By the time the shutdown ended, just after midnight on October 17, 2013, Trump had mostly moved on to other issues. He repeatedly mocked and assailed the "failed" Obamacare website , while also deflecting a persistent rumor about his political future.

Thanks for all of the great support but I just don't see myself wanting to run for Governor of New York - I have something else in mind! — Donald J. Trump (@realDonaldTrump) October 18, 2013

Fast forward to today and it's President Trump in the White House and Republicans in charge of both chambers of Congress.

Republican leadership now is pushing for a short-term "continuing resolution" to keep the government open. Senate Democrats, meanwhile, are on the verge of rejecting it, demanding the fate of DACA recipients, whose protections will expire in March, be resolved now as part of a broader pact.