President-elect Donald Trump has selected former Texas Gov. Rick Perry — who famously once forgot that he wanted to abolish the Energy Department — to be secretary of energy, two sources familiar with the transition process told NBC News on Monday night.

Perry, a rival of Trump's during the Republican presidential nominating campaign, met with Trump for about 90 minutes earlier in the day at Trump Tower in New York.

Perry dropped out of the race and endorsed Sen. Ted Cruz, a fellow Texan. Before he left the race, he denounced Trump's candidacy as "a cancer on conservatism" and criticized Trump, himself, as a "barking carnival act."

By May, however, as it became clearer that Trump was likely to win the Republican nomination, Perry had retreated from his criticism, saying that "I will be open to any way I can help" and that "I believe that Donald Trump should be our guy."

Former Texas Gov. Rick Perry smiles Monday as he leaves Trump Tower, where he met with President-elect Donald Trump. AP

Perry also ran for president in 2012, which led to a gaffe during a debate in November 2011 in which he forgot that he'd named the Energy Department — the agency Trump now wants him to head — as one of three Cabinet departments he'd eliminate. The memory loss became known as Perry's "oops" moment.

As governor, Perry championed the oil industry, questioning science that shows that greenhouse gas emissions contribute to climate change and deriding what he called "the secular carbon cult."

At a presidential town hall in 2011, he said, "I think there are a substantial number of scientists who have manipulated data so that they will have dollars rolling into their projects."

Perry is also likely to be questioned during confirmation hearings about the Dakota Access Pipeline. He serves on the board of directors of Energy Transfer Partners, the company building the controversial project near the Standing Rock Sioux reservation.

The Obama administration recently denied part of the pipeline that would run beneath the Missouri River, the main source of drinking water for the tribe, meaning the project is temporarily on hold.