Alaska governor Bill Walker dropped his re-election bid on Friday and backed the Democratic candidate, shortly after the 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 right before he was to participate in a debate, was met with gasps and cries of “No!”

“‘Alaska First’ is and cannot be just a campaign slogan,” Walker 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 senator Mike Dunleavy and Democratic former US senator Mark Begich.

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

A former Republican and the only independent governor in the US, Walker told reporters he did not agree with Begich on a lot of things. But he said Begich would be better for Alaska than Dunleavy.

Brett Huber, Dunleavy’s campaign manager, blasted Walker.

“Governor Walker could have chosen a dignified, graceful exit to his campaign. Instead, he opted to bow out with a bitter, partisan attack on Mike Dunleavy. It’s too bad – Alaskans deserve better,” Huber said.

Walker was showered with praise by conference attendees. The debate went on without him. Begich called Walker’s action courageous. Dunleavy did not acknowledge it.

Throughout the campaign, some Democrats and independents worried 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”. On Thursday, they both sought to downplay suggestions of a deal. A Division of Elections spokeswoman said ballots have already been printed. Early voting starts on Monday.

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

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

Mallott 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.

Walker said he considers Mallott his closest friend and “soulmate”. In 2014, both were running for governor, trying to unseat Republican Sean Parnell. Walker was a Republican. Mallott was the Democratic candidate and an Alaska Native leader.

With the support of the Democratic party, the two men combined and defeated Parnell. Walker changed his affiliation to undeclared and Mallott became his running mate.

This year, 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 ballot, which ensured that he and Mallott could run together. Libertarian Billy Toien also is running.