Among the key figures embroiled in the impeachment inquiry into President Trump is Energy Secretary Rick Perry, who announced last week that he will be resigning later this year.

It was Perry who led the U.S. delegation to Ukraine when newly elected President Volodymyr Zelenskiy was inaugurated back in May. And it was Perry who urged Trump to make that now-infamous July phone call to Zelenskiy — a phone call that's at the heart of the inquiry. In that call, Trump asked the Ukrainians to investigate former Vice President Joe Biden, his potential rival in the 2020 presidential campaign. The call triggered the whistleblower complaint from an intelligence officer and led to allegations that Trump abused his power for personal political gain. So how did Perry, who just a few years ago was attempting to cha-cha his way through Dancing With the Stars, become a major figure in the impeachment probe? Perry's roots go back to tiny Paint Creek, Texas, in rural Haskell County.

"They used to call him 'the rascal from Haskell,' " says Scott Braddock, who's editor of the Texas political newsletter Quorum Report and has covered Perry for many years. "He grew up not exactly dirt poor but not far from it." The son of tenant farmers, Perry would become a master politician, an expert at cultivating relationships. After winning a seat in the Texas House of Representatives, Perry went on to be elected state agriculture commissioner and lieutenant governor. He assumed the Texas governorship midway through George W. Bush's second term as governor, when Bush won the presidency. Perry was then elected governor three times, serving for 14 years and making him the longest-serving governor in Texas history. "He took being a wheeler-dealer basically to the level of an art form," Braddock says. "Perry was somebody who would always figure out the way to get what he wanted." At first, it might have seemed absurd that what Perry wanted was to join the Trump administration.

After all, in 2015, during his second presidential run, Perry scorched Trump in a speech, calling his Republican opponent's candidacy a "cancer on conservatism" and "a barking carnival act." Trumpism, Perry warned, was "a toxic mix of demagoguery and mean-spiritedness and nonsense that will lead the Republican Party to perdition if pursued." But apparently, all was forgiven after the 2016 election, when Trump picked Perry to head the Energy Department. "Well, you know, feelings change about people all the time," says Deirdre Delisi, who served as chief of staff to then-governor Perry. She worked on four of his campaigns and remains a confidante. "He was asked to serve his country, and as he has done so many other times, he agreed to serve his country, and he did a great job." Many noted the irony that Perry was assuming control of a federal department that he had vowed to eliminate when he was running for president — a promise that led to Perry's notorious "oops" moment during a presidential debate when he couldn't remember which department he had promised to ax. "I would do away with the Education," Perry said haltingly. "Uh, the um ... Commerce. And ... let's see ... I can't. The third one. Sorry. Oops."

As energy secretary, Perry has pretty much flown under the radar up until now, avoiding scandal. He has focused heavily on opening global markets to U.S. oil and gas. At a news conference this month in Lithuania, he described his dealings this way: "I'm a Texas governor, former governor, and I know how to sell stuff. And my job is to go sell, first off, American product." That's the Perry trademark, says Braddock of the Quorum Report. "He was always real good at selling Texas," he says. "Governor Perry's slogan was 'Texas is open for business.' And I think that he wanted to bring that to the national stage and to the international stage — that we're open for business." Specifically: the business of liquefied natural gas, or — as Perry's Energy Department has dubbed it — "freedom gas." It's a growing U.S. export, and Ukraine is a potentially huge market. Historically, Ukraine has depended heavily on natural gas from Russia. So, the thinking goes, if the U.S. could replace Russian gas with U.S. gas, it would be a big win for American companies and for U.S. foreign policy. Ukraine is a critical counterweight to Russian influence in the region.

But the country has also been notorious for corruption, especially in the energy sector, and that has stifled Western investment. So, for years, U.S. administrations have pressed Ukraine to root out corruption. It was in this context that Perry headed to the Ukrainian capital, Kyiv, in May, leading the U.S. delegation to the inauguration of the newly elected president, Zelenskiy. According to the whistleblower's complaint, Vice President Pence was supposed to head that delegation, but Trump instructed Pence to cancel his trip and Perry went in his place. Also with Perry were Gordon Sondland, the ambassador to the European Union, and Kurt Volker, then the U.S. special representative for Ukraine. The trio called themselves the "three amigos." Within days of leaving Kyiv, those "three amigos" were back in the Oval Office, meeting with the president. They told Trump that Zelenskiy was a reformer, and they wanted the president to call him.