Murkowski is one of only a handful of Republican senators who have shown some degree of independence from Trump. The Republican dissenters fall into a few categories. There are the critics, the most vociferous of whom are Jeff Flake and Bob Corker, both senators who are not running for re-election. There are the strayers, among them Murkowski and Collins, who have criticized Trump and also voted against him on major legislation. Rand Paul, the staunch libertarian, votes with Trump less often than any other Republican senator, but he has also gone out of his way to defend him. Lindsey Graham votes with the president slightly more often than Murkowski and Collins, but he joins them in yet another category: the pragmatists. Those senators have staked out the now-controversial position that they would rather get something done than nothing, even if it means compromising with Democrats. Murkowski, who has exercised her independence in all three ways, has nonetheless managed to bring back to her state its most long-desired spoils — more opportunities for drilling and more opportunities for building in previously protected wilderness.

Murkowski landed in the Senate essentially by fiat: In 2002, her father, Frank Murkowski, then a senator, was elected governor of Alaska and had to choose a successor. He publicly considered an up-and-coming mayor from Wasilla, Sarah Palin, then rejected her. Instead, he appointed his daughter Lisa, who had been a state legislator for all of four years. The blatant act of nepotism dogged Frank Murkowski, who went on in 2006 to face Palin in a primary challenge for governor, which she easily won.

That history still seemed fresh in 2010, when Palin backed another Republican, Joe Miller, a friend of Palin’s husband and a Tea Party favorite, in his challenge to Lisa Murkowski in the Republican Senate primary. “I think she’s out for her own self-interest,” Murkowski said of Palin on the evening of the election. To the surprise of many Alaskans, Miller won. “Do you believe in miracles?” Palin tweeted to her followers.

From the moment the result was announced, friends and supporters began texting Murkowski to urge her to run in the general election as a write-in candidate. “Leadership told her not to do it, that she was going to jeopardize the seat and have a Democrat win,” says Andrew Halcro, a former Republican state legislator and a friend who served with Murkowski. “I think at that point, Lisa recognized, ‘I don’t have any friends.’ ” Murkowski decided to mount the write-in campaign.

She ran as a Republican, but in both Alaska and Washington, the party seemed comfortable moving on without her. The National Republican Senatorial Committee spent more than $1 million funding Miller, with the Tea Party Express adding $600,000. Not long after she started the campaign, Murkowski learned, while she was in Alaska, that Senate Republicans were considering voting the next day to remove her from her position as the ranking member on the Energy and Natural Resources Committee. “I have basically been written off by the senatorial committee,” she said, recalling her state of mind in a memoir by Arlen Specter, the moderate former senator from Pennsylvania, “and I’m not going back begging and pleading. My relationships will either stand on their own or not.” In the end, she held on to her post.

Murkowski, whom Palin had tried to cast as part of the entrenched establishment, suddenly became the underdog, a shift that galvanized her campaign. Her team passed out plastic bracelets that said, “fill it in, write it in,” with the correct spelling of her name. Murkowski defeated Miller, with the help of traditional Democratic constituencies like women and Alaska Natives. “It was an unusual coalition for a Republican,” said Mark Begich, at the time Alaska’s other senator and a Democrat.