Popular Democratic President Andrew Shepherd (Michael Douglas) is preparing to run for re-election. The President and his staff, led by Chief of Staff and best friend A.J. MacInerney (Martin Sheen), attempt to consolidate the administration's 63% approval rating by passing a moderate crime control bill. However, support for the bill in both parties is tepid: conservatives do not want it, and liberals think it is too weak. If it passes, however, Shepherd's re-election is presumed by his staff to be a shoo-in, and Shepherd resolves to announce the bill, and the Congressional support to pass it, by the State of the Union.
With the President of France about to arrive in the United States to attend a state dinner in his honor, Shepherd—widowed when his wife died of cancer three years earlier—is placed in an awkward predicament when his cousin Judith, with whom he had planned to attend the dinner, gets sick.
The President's attention soon focuses on Sydney Ellen Wade (Annette Bening), just hired by an environmental lobbying firm to persuade the President to pass legislation committing his Administration to substantially reduce carbon dioxide emissions. During their first meeting, Shepherd and Wade are immediately intrigued by each other. At this meeting, Shepherd strikes a deal with Wade: if she can secure 24 votes for the environmental bill by the date of the State of the Union, he will deliver the last 10 votes. Whatever his personal feelings toward Wade, he expresses this to his staff, especially the pragmatic A.J., as a sound political move. He believes Wade will not be able to get enough votes to meet her side of the deal, thus releasing Shepherd from responsibility if the bill fails to pass.
Later that evening, in a series of phone calls, Shepherd invites Wade to the state dinner. During the State dinner and subsequent occasions, the couple fall in love. When the Republican presidential hopeful Senator Bob Rumson (Richard Dreyfuss) learns "the President's got a girlfriend," he steps up his attacks on Shepherd and Wade, focusing on Wade's activist past and maligning Shepherd's ethics and his family values. The President refuses to respond to these attacks, which drives his approval ratings lower and costs him crucial political support, without which his crime bill seems doomed to failure.
At the White House Christmas Party, Wade is dejected about her meeting that day with three Congressmen from Michigan about the environmental bill and how it was a dismal failure; in the process, she inadvertently mentions to the President and A.J. that the Congressmen in question said the only bill they were more interested in defeating than the President's crime bill was Wade's environmental bill. Shepherd and A.J. are conflicted by this information as Wade clearly had no idea of the implications of this casual conversation, much less that they might actually use this information in their favor and against her environmental bill.
Eventually, Wade does manage to get enough votes to meet her part of the deal. However, in the meantime, Shepherd's team discovers he is exactly three votes short, with no other apparent options to acquire them except by shelving the environmental bill, thus solidifying the support of the three Congressmen from Michigan—which he agrees to do. This results in disaster for Wade as she is immediately fired from her lobbyist job for failing to achieve her objectives, as well as seemingly jeopardizing her political reputation. She visits the White House to break up with Shepherd and says that she has a job possibility in Hartford, Connecticut. He tells her politics is making choices, his number-one has always been the crime control bill, and that he does not want to lose her over this. She congratulates him on getting the leverage to pass a crime bill that in no way will help fight crime. She concludes, "Mr. President, you have bigger problems than losing me—you've just lost my vote."
On the morning that he is to deliver his State of the Union Address, and after an argument with A.J., Shepherd makes a surprise appearance in the White House press room and rebuts Rumson's attacks on Wade's past and his own values and character. He declares he will send the controversial environmental bill to Congress with a massive 20% cut in fossil fuels—far more than the 10% originally envisioned—and that he is withdrawing his support for the weak crime bill, promising to write a stronger one in due time. In his speech he even promises gun control, in an attempt at root-and-branch solving of America's problems. His passionate and erudite defense of those things in which he believes, in contrast to his earlier passive behavior, galvanizes the press and his staff.
Shepherd declares he is "going over to her house and I'm not leaving until I get her back," but Wade enters the Oval Office before he can leave. The couple are reconciled and the President, accompanied by Wade, leaves to give his State of the Union Address. The movie ends with Shepherd entering the House chamber to thunderous applause.

Question: Why did President Shepherd shelf the environmental bill?
Answer: To get support for the crime control bill.
Alternative answer: Shepherd was three votes short.