The West Wing presaged the 2008 election of President Barack Obama with its Matthew Santos (Jimmy Smits) storyline during its final two seasons, which ran in 2005 and 2006. The West Wing was created by writer Aaron Sorkin in 1999 and instantly became a huge hit for NBC. Not only was it a ratings behemoth, it won a slew of Emmys, including Best Drama for its first four seasons. It also served as something of a bridge between the eras network television's domination and the rise of prestige dramas on cable and streaming platforms. In many ways, The West Wing was the last show of its kind.

Sorkin left The West Wing following the conclusion of its fourth season, and the show entered a long, slow decline. The fifth season and the first half of the sixth season carried on in much the same way it had before, chronicling the drama inside the administration of President Jed Bartlet (Martin Sheen). But at the midpoint of season 6, there was a shift in the show's direction; the happenings inside the White House were now secondary to the campaign for the next president, which came down to Democratic Congressman Matthew Santos and Republican Senator Arnold Vinick (Alan Alda).

Related: The Worst Thing Each Main Character From The West Wing Has Done

Santos was a young, optimistic congressman who wanted to expand healthcare for all Americans. The show's writers at the time have admitted that some influence for Santos was derived from Obama, who entered the national stage in 2004 when he gave the keynote speech at the Democratic National Convention. Obama wasn't running for president in 2004 - John Kerry was - but the young state senator left an impression. The West Wing writers recognized Obama's inherent power and charisma and decided to borrow a bit of it for Santos. Meanwhile, in crafting Alda's Vinick, the writers zeroed in on a real politician with a national profile and a reputation for occasionally bucking his party's wishes, Senator John McCain. Perhaps even more so than Obama and Santos, a straight line can be drawn between the no-nonsense, bipartisan maverick McCain and Vinick.

Matthew Santos in The West Wing

Naturally, The West Wing used Santos and Vinick as avatars for real-world issues, including healthcare, the environment, and the war in Iraq, with Santos largely echoing Obama's positions and Vinick almost completely on the same page as McCain. Much like in the real world, the writers had planned on the Republican winning the presidential race, ending the series by mirroring the rightward shift the United States had undergone since the show began at the end of Bill Clinton's second term. However, the death of cast member John Spencer, who played Leo McGarry, Santos' running mate, led the writers to change the ending to a Santos victory.

Similarly, John McCain was considered the favorite to win the presidency in 2008 when Obama surprisingly bested Senator Hillary Clinton in the Democratic primary. But a financial collapse in the fall of 2008 spelled doom for McCain's campaign, as he was seen by many as an extension of the then-unpopular George W. Bush administration; the great irony is Bush and McCain had plenty of political battles over the years. Similarly, on The West Wing, a nuclear accident in his home state sealed Arnold Vinick's electoral fate, brought down by an outside force he ostensibly couldn't have foreseen.

Santos was also the first non-white president in the universe of The West Wing, mirroring Obama's historic victory in real life. Santos may have beaten Obama to The West Wing version of the White House by two years, but Barack Obama's DNA was built into the character, creating an agreeably symbiotic relationship with fact and fiction.

Next: The West Wing: Matthew Perry's Joe Quincy Was Wasted On The Show