NEW YORK (AP) — Fifty-eight floors above Manhattan, President Donald Trump watched his legacy change and his political future grow more uncertain.

The president, back in his hometown of New York for the U.N. General Assembly, was taking "executive time" at his Trump Tower penthouse late Tuesday afternoon when Speaker Nancy Pelosi announced that the House was launching a formal impeachment inquiry against him. Pelosi's move increases the odds that Trump will become the third U.S. president to be impeached.

It was a step more than 2½ years in the making and one that moves the president farther down the path of self-styled political martyrdom.

The product of Trump's norm-breaking presidency and Democrats' lingering anger over the outcome of the 2016 election, the impeachment inquiry has largely been welcomed by the Republican president's advisers, who believe it could backfire against Democrats. The president himself said the move could help his electoral chances, but he reacted in the moment with a cascade of angry tweets that accused Democrats of engaging in "a witch hunt" and "presidential harassment."

A short time earlier, as word of Pelosi's decision first emerged, an agitated Trump sized up the politics of the moment and the developments that have quickly enveloped his presidency since it was revealed that a whistleblower complaint accused him of pressuring the leader of Ukraine to dig up damaging material about political foe Joe Biden's family.

"They're going to lose the election, and they figure this is a thing to do," Trump told reporters. Speaking of Pelosi, he added, "If she does that, they all say that's a positive for me, for the election. You could also say, 'Who needs it? It's bad for the country.'"

The revelations revolve in part around a July 25 phone call the president had with Ukrainian President Volodymyr Zelenskiy in which Trump is said to have asked for help investigating Biden and his son Hunter. In the days before the call, Trump ordered advisers to freeze $400 million in military aid for Ukraine, prompting speculation that he was holding up the money as leverage for information on the Bidens. Trump has denied that charge but acknowledged he blocked the funds.

The West Wing and Trump's informal advisers have been divided over how to handle the story, according to the accounts of eight people who spoke on condition of anonymity because they were not authorized to publicly discuss private conversations. Trump spent part of Monday night consulting with family members and confidants over what to do next.

The president has alternately vented about what he sees as media and Democratic attempts to overplay the Ukraine story line while believing that the episode will work against his political foes. Frustrated by the rapid pace of developments and how they have overshadowed his time at the United Nations, Trump said he believed this was the Democrats trying to get a "do-over" after failing to take him down with special counsel Robert Mueller's Russia probe.

For nearly a year, the White House as an institution and Trump personally have been goading Democrats to open impeachment proceedings. They've refused document requests and ignored subpoenas from Congress, claiming broad executive privilege to prevent the testimony of administration officials and even of people who've never formally worked at the White House.

His strategists have long believed impeachment could be a victory: that the American public would view the move as a purely partisan maneuver that would work against Democrats as it did for Republicans when they went that route against Bill Clinton 20 years ago.

Clinton was not facing reelection; Trump will be on the ballot in 14 months. Moreover, while Trump has largely been convinced by aides that impeachment could be good for his political future, the superstitious, legacy-minded president has told confidants that he is worried that, even if the GOP-controlled Senate were to acquit him as expected, impeachment would become the first line of his political obituary.

As word of the whistleblower complaint slowly made its way through the White House, initial concerns about what the president said on the call quickly gave way to the same sense of defiance that has defined the administration's interactions with Congress. One administration official said there were intense divisions among the West Wing staff and lawyers on whether to release the transcript, a move they believed would exonerate the president but set a dangerous precedent for future administrations. It also could ease the very tensions with Congress that the White House has seen to be politically advantageous.

Even while Trump was weighing whether to authorize the release, he insisted to those around him that the transcript would clear him of any wrongdoing. And he and his closest allies believe that when more is known about the Biden family's involvement in Ukraine, it could damage the electoral prospects of the one candidate Trump himself has mused could peel off some his support among white working-class voters in the Midwest.

By Tuesday, as it became clear that House Democrats were set on an impeachment inquiry, Trump approved release of the "unredacted" transcript. "You will see it was a very friendly and totally appropriate call," he tweeted between meetings at the United Nations. "No pressure."

Most aides believe that Trump's vague, wink-wink style of speaking would not lend itself to the discovery of a smoking gun in the transcript. But it's possible the White House will authorize the release of the entire whistleblower complaint to Congress by the end of the week.

As Democrats pursue impeachment, Trump and his allies believe it could make him a martyr in the eyes of his faithful, providing the necessary motivation to bring his supporters to the polls in droves. Trump's reelection strategy hinges on turning out die-hard supporters who are unreliable voters rather than winning over skeptics at the center of the electorate. Trump is betting that anger at what he claims is Democratic mistreatment will prove to be a political motivator, and that impeachment proceedings will only add to the nation's pox-on-both-houses view of Washington.

After Pelosi's Tuesday afternoon announcement, the president and his reelection team swung into high gear, releasing a series of tweets attacking Democrats, including a video of presidential critics like the speaker and Rep. Ilhan Omar discussing impeachment. It concluded with a message for the Trump base: "While Democrats 'Sole Focus' is fighting Trump, President Trump is fighting for you."

But while the campaign set a confident tone, the angry tweets from the Trump Tower penthouse kept coming as the last light faded from the Manhattan sky.

___

Miller reported from Davenport, Iowa. Associated Press writer Mike Balsamo in Washington contributed to this report.

___

Follow Lemire on Twitter at http://twitter.com/@JonLemire and Miller at http://twitter.com/@zekejmiller

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.