Editor's note: This story has been updated throughout.

WASHINGTON — The U.S. Senate approved the confirmation of Rick Perry as the next secretary of the Department of Energy on Thursday. The vote was 62-37, and included the support of both Texans in the chamber, U.S. Sens. John Cornyn and Ted Cruz.

Perry will now take over the very department he famously forgot during a presidential debate in 2011 while trying to list the three he wanted to eliminate.

Thursday's vote marks a striking comeback for Perry, who struggled for years after his disastrous 2011 presidential campaign and was a contestant late last year on "Dancing With the Stars."

But over the course of his confirmation, the former governor presented himself as more polished than some of his past public stumbles had suggested, deftly handling questioning during his hearing before the Senate Committee on Natural Resources and Energy.

Perry, at times a lightning rod back home in Texas, was one of the least controversial nominees President Trump put forward for his Cabinet. Much of that ease came about from Perry's comments during his confirmation hearing, when he said, among other things, that he would pursue “sound science” as energy secretary and that human activity has contributed to climate change.

This makes Perry the third Texan to serve as secretary of energy. Houstonian Charles Duncan served in this post under President Jimmy Carter, as did Laredo native Federico Peña in the Clinton administration.

As part of the Department of Energy, Perry will be responsible for maintaining the security of the country's nuclear weapons. During his confirmation hearing, Perry vowed repeatedly to "modernize the nation's nuclear stockpile." What that will mean under the Trump administration remains to be seen, as President Trump has indicated he wants to “expand” America’s nuclear arsenal, and has said he is willing to restart a nuclear arms race.

Earlier Thursday, Senators held a cloture vote to end debate on Perry's confirmation, effectively putting the former Texas governor on a smooth path to confirmation. Perry needed the support of at least 60 senators on that initial vote. The final vote was 62-37.

Perry's nomination as energy secretary crystallized a remarkable turnaround in his relationship with President Donald Trump. As a GOP presidential rival, Perry ripped Trump in the summer of 2015 as a "cancer on conservatism." But he was also one of the first establishment Republicans to fall in line once Trump essentially locked down the nomination last May.

The context of Thursday's votes on Perry came amid a frenetic day on Capitol Hill. Another Trump adviser, U.S. Attorney General Jeff Sessions, is under fire for communications with the Russian ambassador to the United States, an apparent contradiction to his January testimony before the Senate Judiciary Committee.

Vice President Mike Pence swore in Perry late Thursday afternoon, in a dual ceremony with the new Secretary of Housing and Urban Development, Ben Carson, according to a pool report.

Cruz was on hand, along with senior White House adviser Kellyanne Conway.

Perry brought the same Bible he used to swear in officials as governor, and it included their signatures. Perry pointed to the signature of Texas Supreme Court Justice Don Willett, calling him "Mr. Twitter champion."

In his remarks, Perry noted the significance of March 2 as Texas Independence Day. In a nod to the newly sworn-in Interior Secretary Ryan Zinke's Thursday commute to work on horseback, Perry joked he would arrive on his first day "on a single-stage rocket ... what could go wrong?"

Mariana Alfaro is contributed to this report.

Read more related coverage: