Alexander Hamilton seemed destined to share his starring role on paper currency with an American woman, thanks to the immutable forces of bureaucracy. His bill was up next for a redesign right as President Obama decided to finally put a woman on one.

But something else Hamilton couldn’t have fathomed – a Pulitzer-prize-winning hip-hop musical of his life becoming a hit that very same year – probably played a role in keeping the $10 bill all to himself. Well, that and the fact that a viral campaign and women at the highest levels of political power wanted Hamilton to stay and someone else – specifically President Andrew Jackson – to go.

On Wednesday, they got their wish. The Treasury Department announced it would be putting Harriet Tubman on the $20 bill – an about-face from its original plan to put a woman (just who, specifically, was undetermined before Wednesday) on the $10.

The original plan seemed to catch off-guard the advocates of putting a woman on U.S. currency, who had exclusively focused their efforts on the $20 bill that frames controversial pro-slavery, pro-Native American-removal president Andrew Jackson’s face.

At first, backlash to Hamilton was kind of muted. It was tough to complain about finally getting a woman on a dollar bill, but it also wasn’t really what advocates wanted. “I’m excited to hear that our mission will be accomplished,” Susan Ades Stone, Women on 20s director, told The Washington Post’s Ylan Q. Mui and Abby Ohlheiser. She added she was resigned to letting Jackson stay on because it’d be quicker to swap out the $10.

But as Ohlheiser reported, advocates felt there were solid reasons for getting rid of Jackson. Slate initially pitched the idea of doing away with the seventh U.S. president’s face on the $20 bill in 2014, writing: “Andrew Jackson engineered a genocide. He shouldn’t be on our currency.”

A group that calls itself W20, or Women on 20s, picked up the idea and ran with it. Earlier in 2015, before Lew’s announcement, it coordinated an online campaign to replace Jackson. It went viral. More than 600,000 voters nominated Tubman, the nation’s most famous abolitionist and the conductor of the Underground Railroad, to replace the man you could argue is her polar opposite.

W20 added its own convincing arguments for why Jackson should go. If the $20 honored a woman by 2020, it’d also mark the 100th anniversary of women’s suffrage, which would be neat. Plus, no one’s actually sure why Jackson ended up on the bill in the first place back in 1928. The man didn’t even like paper currency, after all, favoring gold and silver coins.

The proposal made it to Capitol Hill, too – if only symbolically. In April 2015, Sen. Jeanne Shaheen, D-N.H., introduced a measure to put a woman on the $20 bill and got an introduction in the Senate – even as it was the sole duty of Treasury to make the decision, not Congress. Shaheen indicated there was a lot of support for her idea: “The incredible grassroots support for this idea shows that there’s strong support for a woman to be the new face of the $20 bill.”

And if the Treasury was feeling pressure for its decision not to boot Jackson, it was also getting an increasing amount of pressure for its decision to boot Hamilton. The ethnically and musically diverse Broadway hit “Hamilton” was becoming too popular to ignore, as The Post reported in April. (The play won its Pulitzer just two days ago.)

A relatively overlooked founding father became the epitome of cool, and suddenly the fight to change the $20 over the $10 became as much about honoring a woman as it was about protecting the legacy of a man.

None other than the musical’s writer, Lin-Manuel Miranda, gave the impression he personally lobbied Lew to keep his guy on. He tweeted:

I talked to USTreasury about this on Monday. Sec. Lew told me “you’re going to be very happy.” wegetthejobdone

As The Post reported in April:

“Hamilton,” which takes an admiring look at the founder of the United States’ financial system, debuted on Broadway nine months ago. It’s gripped the country so deeply with the story of Alexander Hamilton that some tickets are going for $1,365 per seat on the resale market, the L.A. Times reports.

Lew’s a noted fan. He gushed in New York magazine about both the show and meeting Lin-Manuel Miranda, who plays Hamilton and wrote the hit musical, after the performance.

“When I met him, I said, ‘Well, I’ve made my case,’ ” Miranda told the New York Times, concerning that backstage meeting.

Lew again met with Miranda the day before the cast played selections of the musical for the president last month.

“On Monday, Secretary Lew welcomed Lin-Manuel Miranda to the U.S. Department of the Treasury,” said a Treasury department spokesperson in a statement, Variety reported. “The secretary and Miranda talked about the enduring mark Alexander Hamilton left on our nation’s history and the secretary provided a brief tour of Hamilton’s possessions and portraits on display at the Treasury Department. The secretary thanked Miranda for the ingenious way in which he has been able to tell Hamilton’s story and ignite a renewed interest in one of our nation’s founding fathers. Secretary Lew also reiterated his commitment to continue to honor Alexander Hamilton on the 10 dollar bill.”

In April of this year, Hillary Clinton told a New York Daily News editorial board meeting she’d “keep Hamilton where he is.” He was a New Yorker, an immigrant and one of George Washington’s closest aides, she said, according to the paper. Oh and also, she liked the musical.

And that’s the modern-day story of Hamilton vs. Jackson. At first, bureaucracy and timing seemed to conspire to kick Hamilton off the $10 bill. But then, 21st-century forces – social media, political pressure and some really great hip-hop songs – appeared to help keep him on and give Jackson the boot instead.