Sept 22 (Reuters) - Texas Governor Rick Perry's embarrassing inability to remember a government department he would eliminate if he became president, perhaps the biggest gaffe of the 2012 election campaign, was due to chronic lack of sleep, a new book says.

"Oops," a diary of covering the Perry campaign by Texas Tribune correspondent Jay Root, says Perry suffered from insomnia for weeks before the gaffe.

The blunder occurred during a Republican presidential debate in Rochester, Michigan on Nov. 9, 2011.

Trying to recall the three government departments he would eliminate if he became president, Perry said: "I would do away with the Education, the, uh, Commerce, and, let's see. I can't. The third one I can't. Sorry. Oops."

He paused for an agonizing 53 seconds before conceding that he could not remember the Energy department, the third agency he would close.

Book author Root, who covered the Perry presidential campaign from the summer of 2011 to its end in early 2012, said Perry had battled insomnia most of the campaign.

Perry stumbled in several debates and at one debate in Orlando, Florida, one of his answers was almost incoherent.

"Perry had kept in touch with his medical team, and by early October, days after the Florida fiasco, the campaign had urgently consulted sleep specialists, bringing them in to investigate.

"After conducting overnight tests on Perry, they produced a rather startling diagnosis: He had sleep apnea, and it had gone undetected for years, probably decades," Root says.

Perry's unraveling began in earnest after back surgery in mid-June, 2011. The Texas governor took pain killers for a few weeks after the surgery but refused to continue them because he said he wanted to be mentally sharp for the campaign.

By October, Perry was diagnosed with sleep apnea, a chronic condition in which a patient sleeps so lightly that he is constantly waking and breathing can stop for a moment. Perry was given a machine that helps breathing become more regular during sleep.

But at the same time he complained of pain in his leg and foot that might have been a result of the surgery. This kept him from sleeping, Root says.

A request for comment from the governor's office on Saturday did not receive an immediate response. (Reporting by Corrie MacLaggan; Writing by Greg McCune; Editing by Todd Eastham)

Related on HuffPost:

Loading Slideshow...
  • "Oops"

    At the CNBC debate on November 9, Perry <a href="http://www.huffingtonpost.com/2011/11/10/rick-perry-oops-video_n_1085336.html" target="_hplink">famously forgot</a> one of the government agencies he would eliminate if elected: <blockquote>"It's three government agencies when I get there that are gone: Commerce, Education and the um, what's the third one there. Let's see," Perry said. He turned to Texas Rep. Ron Paul, looking for some help, but got nothing but a remark from Paul that he would eliminate five agencies. "Oh five," Perry said. "So Commerce, Education, and, uh, the uh, um, um." "EPA?" offered former Massachusetts Gov. Mitt Romney. "EPA, there ya go," Perry said as the room exploded in laughter. CNBC moderator John Harwood honed in and pressed Perry: "Seriously? Is EPA the one you were talking about?" "No sir. No sir. We were talking about the, um, agencies of government," Perry said. "The EPA needs to be rebuilt." "But you can't name the third one?" Harwood persisted. "The third agency of government," Perry said. "I would do away with the education, the um, Commerce, and let's see. I can't think of the third one. I can't. Sorry. Oops."</blockquote>

  • Voting Age Flub

    <a href="http://www.huffingtonpost.com/2011/11/29/rick-perry-gets-voting-ag_n_1119126.html" target="_hplink">During a campaign stop</a> at Saint Anselm College in New Hampshire, Perry got both the voting age and the date of the 2012 presidential election wrong. "Those of you that will be 21 by November the 12th, I ask for your support and your vote," he said to the students. The legal voting age has been 18 since the 26th Amendment was adopted in 1971. The general election is scheduled for November 6, 2012.

  • New Hampshire... Caucus?

    During a November <a href="http://www.huffingtonpost.com/2011/11/30/rick-perry-new-hampshire-caucus_n_1120304.html" target="_hplink">interview </a>with Fox News, Perry mistakenly referred to the New Hampshire "caucuses." When asked about the emergence of front runners Mitt Romney and Newt Gingrich, Perry responded, "Americans haven't decided yet at all who they want to lead the Republican nomination, and we're going to be talking about that and we're going to be talking about it in harsh and strong terms over the course of the next four to five weeks as we get ready for those New Hampshire caucuses." New Hampshire holds primaries, not caucuses.

  • Minimum Age To Run For President

    While speaking to Catcher Jones, a seven-year-old from Greenville, South Carolina in December, Perry flubbed the minimum age to run for president. "I'm glad you're not 21," Perry told Jones, who was wearing a t-shirt that said "Future President: Accepting Campaign Donations Now." Perry realized his mistake and added, "Or actually 35."

  • War With Iran

    After a woman in South Carolina asked Perry what he thought about current United States military operations, Perry mistakenly started talking about the wars in Afghanistan and Iran. When an audience member alerted Perry to his error, he joked that his comment "will be on the front page."

  • Revolutionary War

    Following a debate in New Hampshire, Perry met with fraternity brothers at Dartmouth College. When someone asked him about the issue of states' rights, Perry said that one of the "reasons we fought the revolution in the 16th century was to get away from that kind of onerous crown." The Revolutionary War occurred in the 18th century.

  • Decade Mix-Up

    <a href="http://www.youtube.com/watch?feature=player_embedded&v=OMK7La2721Y" target="_hplink">In an interview</a> with CNN last year, Perry got stuck in a time warp. "Washington has abused the Constitution. You go back to the, a decade ago, with Woodrow Wilson..." Wilson was president from 1913 to 1921.

  • Bizarre Campaign Speech

    In October, <a href="http://www.huffingtonpost.com/2011/10/29/video-rick-perrys-unusual-speech-performance_n_1065571.html" target="_hplink">an unusual performance</a> at a speech in Manchester led many to question the candidate's sobriety. Perry later made a statement to dispel rumors that he was drinking or using painkillers during the speech.

  • Bush Was Good At "Defending Us From Freedom"

    During an interview with the <em>Today Show</em> last November, Perry told host Meredith Viera that "Bush did an incredible job, in the presidency, defending us from freedom."

  • "Montomayor"

    While speaking with the editorial board of the <em>Des Moines Register</em>, <a href="http://www.huffingtonpost.com/2011/12/09/rick-perry-gaffe-sonia-sotomayor_n_1139541.html?1323463939" target="_hplink">Perry struggled</a> to remember Supreme Court Justice Sonia Sotomayor's name: <blockquote>"Do you really think he [President Barack Obama] is waging a war on religion?" asked an editorial board member, referring to Perry's recent ad pledging to "end Obama's war on religion" and "fight against liberal attacks on our religious heritage" as president. "I do because when you see his appointment of two -- from my perspective, inarguably -- activist judges, whether it was," he said, then trailing off for about six seconds trying to recall her name. "Montomayor," he said. Someone on the editorial board said Sotomayor's name. "Sotomayor and [Elena] Kagan, who are both activist judges," he continued.</blockquote>