JUNEAU, Alaska — Alaska Gov. Bill Walker dropped his re-election bid Friday, three days after the sudden resignation of his lieutenant governor over what Walker described as an inappropriate overture toward a woman.

Walker’s announcement, made at the Alaska Federation of Natives conference in Anchorage shortly before he was to participate in a debate, was met with gasps and cries of “No!” from the audience.

“‘Alaska First’ is and cannot be just a campaign slogan,” he said. With less than three weeks until the election, Walker, an independent, said it became clear he could not win a three-way race against Republican former state Sen. Mike Dunleavy and Democratic former U.S. Sen. Mark Begich.

Alaskans deserve a competitive race, “and Alaskans deserve a choice other than Mike Dunleavy,” he said.

Walker, a former Republican and the only independent governor in the country, told reporters he doesn’t agree with Begich on a lot of things. But he said Begich would be better for Alaska than Dunleavy.

Walker was showered with praise and hugs by conference attendees after his announcement. The debate went on without him. Begich called Walker’s action courageous. Dunleavy did not acknowledge it in his opening statements.

Walker’s campaign was rocked Tuesday by the resignation of Lt. Gov. Byron Mallott, a Democrat who was replaced by former state health commissioner Valerie Davidson.

Throughout the campaign, some Democrats and independents worried that Walker and Begich would split the vote, giving the election to Dunleavy. Walker was elected in 2014 with Democratic support.

Walker’s campaign manager earlier this week said Walker and Begich had been in talks about a “path forward for Alaska” but would not elaborate. On Thursday, they both sought to downplay any suggestions of a potential deal ahead of the Nov. 6 election.

A Division of Elections spokeswoman said ballots have already been printed. Early voting in the state starts Monday.

Casey Steinau, chairwoman of the state Democratic party, lauded Walker for “stepping aside for the greater good.”

Mallott, in a resignation letter, apologized for “inappropriate comments I made that placed a person whom I respect and revere in a position of vulnerability.”

Few details have been released because Walker said he is honoring the wishes of the woman involved.

The partnership of Walker and Mallott — and blurring of partisan lines — was a central theme of their administration and campaign. Walker said he considers Mallott his closest friend and “soul mate.”

In 2014, Walker and Mallott were each running for governor, trying to unseat Republican Gov. Sean Parnell. Walker was a Republican mounting an outsider bid. Mallott was the Democratic candidate and an Alaska Native leader.

With the support of the Democratic party, the two men, who had developed a friendship, combined their campaigns and defeated Parnell. Walker changed his affiliation from Republican to undeclared, and Mallott became Walker’s running mate.

This year, their desire to run together helped seal what some had already seen as an uphill battle for Walker because of the three-way race. Though Democrats now allow independents to run in their primaries, Walker opted against that when it appeared Begich would run. He instead gathered signatures to appear on the general election ballot, which ensured that he and Mallott could run together. Libertarian Billy Toien also is running for governor.

Walker, 67, is no stranger to the underdog role and embraced it through much of the campaign. He often speaks of the emotional and financial toll of rebuilding his hometown of Valdez after a devastating 1964 earthquake. As a kid, he worked odd jobs to help make ends meet and helped his father with his construction business. He said the quake changed him — teaching him lessons about faith, perseverance and working together.

In 2014, oil prices, which had reached around $110 a barrel, began a freefall, bottoming out at $26 a barrel in early 2016. For a state heavily reliant on oil, the impact was severe, creating a multibillion-dollar budget deficit. Alaska fell into a recession.

As governor, Walker faced criticism for halving the size of the check Alaskans received from the state’s oil-wealth fund in 2016. He defends his decision as proper; it came amid legislative gridlock over how to address the deficit. But critics labeled him a thief.

“I ran for the job to do the job, not to keep the job,” he said in a recent interview, describing that and other difficult decisions.