PHOTO: CNN
Now playing
02:19
Trump: Deal reached to reopen government
White House press secretary Jen Psaki speaks during her first press briefing at the White House, Wednesday, Jan. 20, 2021, in Washington. (AP Photo/Evan Vucci)
White House press secretary Jen Psaki speaks during her first press briefing at the White House, Wednesday, Jan. 20, 2021, in Washington. (AP Photo/Evan Vucci)
PHOTO: Evan Vucci/AP
Now playing
01:48
WH press secretary vows transparency and honesty on first day
Now playing
02:30
Pences share a laugh with Vice President Harris and her husband
Now playing
01:12
Kamala Harris sworn in as Vice President
President Donald Trump speaks at Joint Base Andrew on Wednesday, January 20.
President Donald Trump speaks at Joint Base Andrew on Wednesday, January 20.
PHOTO: CNN
Now playing
02:00
See Trump's final message as President as his family looks on
WASHINGTON, DC - JANUARY 20: U.S. Vice President-elect Kamala Harris greets Vice President Mike Pence as she arrives to the inauguration of U.S. President-elect Joe Biden on the West Front of the U.S. Capitol on January 20, 2021 in Washington, DC.  During today
WASHINGTON, DC - JANUARY 20: U.S. Vice President-elect Kamala Harris greets Vice President Mike Pence as she arrives to the inauguration of U.S. President-elect Joe Biden on the West Front of the U.S. Capitol on January 20, 2021 in Washington, DC. During today's inauguration ceremony Joe Biden becomes the 46th president of the United States. (Photo by Alex Wong/Getty Images)
PHOTO: Alex Wong/Getty Images
Now playing
01:20
Why the color Kamala Harris is wearing is significant
banon wayne split
banon wayne split
PHOTO: Getty Images
Now playing
02:00
Trump pardons 73 people, commutes sentences of 70 others
US Vice President-elect Kamala Harris (2nd L) with husband Douglas Emhoff and US President-elect Joe Biden (R) with wife Dr. Jill Biden watch as a Covid-19 Memorial is lighted at the Lincoln Memorial in Washington, DC, on January 19, 2021 to honor the lives of those lost to Covid-19. (Photo by JIM WATSON / AFP) (Photo by JIM WATSON/AFP via Getty Images)
US Vice President-elect Kamala Harris (2nd L) with husband Douglas Emhoff and US President-elect Joe Biden (R) with wife Dr. Jill Biden watch as a Covid-19 Memorial is lighted at the Lincoln Memorial in Washington, DC, on January 19, 2021 to honor the lives of those lost to Covid-19. (Photo by JIM WATSON / AFP) (Photo by JIM WATSON/AFP via Getty Images)
PHOTO: Jim Watson/AFP/Getty Images
Now playing
03:42
'Striking': Tapper on Biden's Covid-19 memorial being first of its kind
trump farewell message
trump farewell message
PHOTO: White House Photo
Now playing
03:18
Trump offers 'best wishes' to new administration in farewell address
WASHINGTON, DC - JANUARY 17: The U.S. Capitol dome is seen beyond a security fence on January 17, 2021 in Washington, DC. After last week
WASHINGTON, DC - JANUARY 17: The U.S. Capitol dome is seen beyond a security fence on January 17, 2021 in Washington, DC. After last week's riots at the U.S. Capitol Building, the FBI has warned of additional threats in the nation's capital and in all 50 states. According to reports, as many as 25,000 National Guard soldiers will be guarding the city as preparations are made for the inauguration of Joe Biden as the 46th U.S. President. (Photo by Michael M. Santiago/Getty Images)
PHOTO: Michael M. Santiago/Getty Images
Now playing
01:15
12 Army National Guard members removed from inauguration duty
Trump turns to reporters as he exits the White House to walk toward Marine One on the South Lawn on January 12, 2021 in Washington, DC.
Trump turns to reporters as he exits the White House to walk toward Marine One on the South Lawn on January 12, 2021 in Washington, DC.
PHOTO: Drew Angerer/Getty Images
Now playing
04:13
'He is actually worried': Collins reports on Trump pardon meeting
Left to right: Janet Yellen, Alejandro Mayorkas, Avril Haines, Lloyd Austin, and Antony Blinken
Left to right: Janet Yellen, Alejandro Mayorkas, Avril Haines, Lloyd Austin, and Antony Blinken
PHOTO: AFP & Getty Images
Now playing
04:32
Take a look at Biden's top cabinet nominees
Now playing
01:50
Ashley Biden on Beau's memory and the White House transition
PHOTO: Pool/Getty Images
Now playing
02:04
Mitch McConnell: Capitol rioters were fed lies
PHOTO: CNN
Now playing
02:51
Why Black voters are hopeful for change under Biden administration
Bill Barr itvnews
Bill Barr itvnews
PHOTO: itv news
Now playing
02:22
Election fraud rhetoric 'precipitated riots' says Barr

Editor’s Note: Julian Zelizer is a professor of history and public affairs at Princeton University and the author, with Kevin Kruse, of the new book “Fault Lines: A History of the United States Since 1974.” The opinions expressed in this commentary are his own. View more opinion at CNN.

(CNN) —  

The shutdown is finally ending. President Donald Trump went on television Friday afternoon and announced he will allow the government to reopen for three weeks.

Although picking winners and losers in politics is always tricky, there is a clear-cut case to be made that House Speaker Nancy Pelosi just completed a masterful political strategy that brought Trump to his knees. The President is going to do what the Democrats have demanded all along: Open the government now, negotiate over border security and the wall later.

Trump leaves the budget battle without getting what he wanted, badly damaged with the electorate, including among some Republican voters, and with the first cracks having emerged among congressional Republicans. This was not how he wanted to head into the year as the investigations into his administration seriously heat up.

How did Pelosi do it? What were the basic strategic moves that she made to so decisively block a President who has survived much longer than his 15 minutes of fame?

The most important factor was that Pelosi did not hesitate to use her political power aggressively. From the start of this process, she has remained steadfast in her insistence that closing the government was not a legitimate way to make demands for new forms of spending.

While sometimes Democrats become leery about seeming too partisan and not being civil enough, Pelosi and the Democrats stood their ground. She drew a line in the sand and stuck by it.

When Trump tried to ignore her first letter about the State of the Union address, she was quick to send a second one with the direct message that he would not be allowed to speak if the doors of government were shut. Institutional power is the primary mechanism through which to restrain a president.

Pelosi also did a good job keeping almost every Democrat in line. She ruled the caucus with an iron fist, making certain that none of her members opted for some kind of bipartisan deal contravening her approach. This kind of party unity is something that the Republicans have perfected, but Democrats can have trouble maintaining.

Not only did she do this with the House, but she also worked closely with Senate Minority Leader Charles Schumer to make sure that members held in the upper chamber. Other than with Joe Manchin, the strategy worked. With discipline, a party can make things very difficult for the President, as Republicans showed under President Barack Obama.

In a refreshing manner, Pelosi also refused to give in to the chaotic frenzy of the Trump White House. The strategy was apparent when she and Schumer met with Trump in the bizarre televised conference in the Oval Office. She sat quietly and let Trump be Trump. She didn’t have to say much as the President proudly claimed ownership to the shutdown before it even began.

Since that meeting his statements and misstatements, as well as those of his tin-eared advisers, only hurt the administration’s cause. Rather than jumping into each outrageous statement, she remained calm and let the President do her work for her. When he tried to overrule her letter disinviting him to make the State of the Union on January 29, she was clear that he didn’t get to set the date and time of the speech just because he wanted it.

The speaker also understood something that Democrats often forget: Americans like their government. While polls usually show that the public opposes government in the abstract, when asked about specific measures such as Social Security or homeland security people sing a different tune.

Get our free weekly newsletter

This is the dynamic that is usually at work with government shutdowns. As the pain of having no government becomes clear – such as the announcement of airport delays Friday with dizzying maps of planes thrown off course – people usually become unhappy. Most Republicans remembered this from the shutdowns in 1995-1996 and 2013. Pelosi certainly did. Trump did not. And now he is paying the price.

Many new members of the House were uncertain about voting for Pelosi to be their leader. She quickly quashed the insurgents. But now, in her first official confrontation with Trump, she has proven her chops to all of them. It is no wonder the President has been so reluctant to tweet about her or give her a demeaning nickname. He has seen his top opponent, and the President is scared.