WASHINGTON - Intelligence communities on both sides of the Canada-U.S. border were rocked Friday by news of the unexpected resignation of CIA director David Petraeus over an extra-marital affair.

Petraeus disclosed the affair in a memo to CIA staff on Friday afternoon, telling them "such behaviour is unacceptable, both as a husband and as the leader of an organization such as ours."

The dispatch came a day after he reportedly told President Barack Obama of the transgression and offered his resignation. Earlier Friday, the president accepted the offer.

Petraeus, one of America's most revered military leaders, had been head of the CIA for barely a year after serving as the commander of international forces in Afghanistan from 2010 to 2011.

Prior to that, he was head of the U.S. Central Command and commanding general of American forces in Iraq.

At the CIA, he replaced Leon Panetta, who moved to the Pentagon to become secretary of defence.

Petraeus, 59, was a highly respected figure in the U.S. capital, and an occasional presence on the city's social scene.

Just last month, the retired four-star general rubbed elbows at the Canadian embassy with Ben Affleck, Jennifer Garner and John Goodman at a reception for the release of Affleck's film, "Argo."

The critically acclaimed movie tells the story of how Canadian and American officials — in particular a daring CIA agent — schemed to help six diplomats escape Iran during the 1979 hostage crisis.

Ambassador Gary Doer, the host of the soiree, later said Petraeus was "the biggest star in the room."

Petraeus has been married for 37 years. His wife, Holly, also works in the Obama administration as an official with the Consumer Financial Protection Bureau.

His resignation marks a stunningly ignominious end to a storied career, made even more sordid by revelations that the FBI is investigating his biographer for improperly trying to access his email and possibly gaining access to classified information.

Paula Broadwell, the author of Petraeus's biography, "All In," is reportedly the focus of the FBI probe.

She was granted exclusive access to Petraeus in Afghanistan and has been interviewed several times, including on "The Daily Show," about the former CIA head. The biography on her now-defunct website stated she is married to a radiologist in Charlotte, N.C., and has two children.

In a written statement, Obama praised Petraeus for providing "extraordinary service" to his country for decades.

"By any measure, through his lifetime of service David Petraeus has made our country safer and stronger," he said.

"Going forward, my thoughts and prayers are with Dave and Holly Petraeus, who has done so much to help military families through her own work. I wish them the very best at this difficult time."

Michael Morell, the agency's deputy director, has been appointed to serve as acting director.

A Canadian intelligence official said the CIA is typically uneasy when those with a military background take control.

"The military is top down, yes-sir-no-sir, and the agency isn't," said the Canadian, who spoke on condition of anonymity.

"They were certainly worried about Petraeus. When Petraeus was commander in Afghanistan, he kept making rosy assertions that the surge was going great and accusing the agency of being too negative. The analysts were worried that he might try to suppress contrary views."

Intelligence officials also worried that Petraeus was too showy, the Canadian said.

"He had a reputation for being talented, hard-working and disciplined, but also a bit a of a showboat. His nickname in the Pentagon was 'King David.'"

Loading Slideshow...
  • Super Bowl XLIII Football

  • CIA-Director David Petraeus

  • Gen. Petraeus Testifies At Senate Confirmation Hearing

    WASHINGTON - JUNE 29: U.S. Gen. David Petraeus, the commander of U.S. forces in the Middle East, speaks during his confirmation hearing before the Senate Armed Services Committee as his wife Holly Petraeus listens on Capitol Hill June 29, 2010 in Washington, DC. Petraeus has been appointed by U.S. President Barack Obama to replace U.S. Gen. Stanley McCrystal as commander of the United States Forces Afghanistan. (Photo by Brendan Smialowski/Getty Images)

  • Defense Secretary Panetta Holds Briefing At Pentagon

    ARLINGTON, VA - OCTOBER 18: Holly Petraeus (R), assistant director for the Office of Servicemember Affairs at the Consumer Financial Protection Bureau, speaks as Acting Deputy Assistant Secretary of Defense for Military Community and Family Policy Chuck Milam looks on during a news briefing October 18, 2012 at the Pentagon in Arlington, Virginia. The Pentagon held a briefing on efforts to enhance the financial health of the force. (Photo by Alex Wong/Getty Images)

  • Petraeus Retirement

  • Petraeus Intelligence

  • Fort Cambell General Returns

  • CIA Director David Petraeus Rings The Opening Bell At The New York Stock Exchange

    NEW YORK, NY - SEPTEMBER 18: Central Intelligence Agency Director David Petraeus walks the floor of the New York Stock Exchange to ring the Opening Bell as the CIA Commemorates it's 65th Anniversary on September 18, 2012 in New York City. Stocks fell in early trading as investors continued to be concerned about Europe and the global economy. (Photo by Spencer Platt/Getty Images)

  • Biden Petraeus CIA

  • CIA-Direktor David Petraeus zurueckgetreten

  • CIA Director David Petraeus, testifies b

    CIA Director David Petraeus, testifies before the US Senate Intelligence Committee during a full committee hearing on 'World Wide Threats.' on January 31, 2012 on Capitol Hill in Washington, DC. Witnesses include: Director of National Intelligence, James Clapper, FBI Director Robert Mueller(L); Defense Intelligence Agency Director Lt. Gen. Ronald Burgess; National Counter terrorism Center Director Matthew Olsen; Assistant Secretary of State for Intelligence and Research Philip Goldberg; and Homeland Security Undersecretary for Intelligence and Analysis Caryn Wagner. AFP PHOTO/Karen BLEIER (Photo credit should read KAREN BLEIER/AFP/Getty Images)

  • Military Family Spending

  • Defense Secretary Panetta Holds Briefing At Pentagon

    ARLINGTON, VA - OCTOBER 18: Acting Deputy Assistant Secretary of Defense for Military Community and Family Policy Chuck Milam (R) speaks as Holly Petraeus, assistant director for the Office of Servicemember Affairs at the Consumer Financial Protection Bureau, looks on during a news briefing October 18, 2012 at the Pentagon in Arlington, Virginia. The Pentagon held a briefing on efforts to enhance the financial health of the force. (Photo by Alex Wong/Getty Images)

  • Biden Petraeus CIA

  • House Holds Hearing On Protecting Service Members In Consumer Financial Marketplace

    WASHINGTON, DC - NOVEMBER 03: Holly Petraeus, assistant director for service member affairs at the Consumer Financial Protection Bureau, participates in a Senate Banking, Housing and Urban Affairs Committee hearing on Capitol Hill, on November 3, 2011 in Washington, DC. The committee heard testimony from Petraeus on protecting veterans and active service members and their families in the consumer financial marketplace. (Photo by Mark Wilson/Getty Images)

  • House Holds Hearing On Protecting Service Members In Consumer Financial Marketplace

    WASHINGTON, DC - NOVEMBER 03: (L-R) Sen. Jack Reed (D-RI) introduces himself to Holly Petraeus, assistant director for service member affairs at the Consumer Financial Protection Bureau, during a Senate Banking, Housing and Urban Affairs Committee hearing on Capitol Hill, on November 3, 2011 in Washington, DC. The committee heard testimony from Petraeus on protecting veterans and active service members and their families in the consumer financial marketplace. (Photo by Mark Wilson/Getty Images)

  • Petraeus Retirement

  • David Petraeus Sworn In As CIA Director

    WASHINGTON, DC - SEPTEMBER 06: Vice President Joseph Biden (R) swears in David Petraeus (C) to be Director of the Central Intelligence Agency, while his wife Holly Petraeus holds a Bible, in the Roosevelt Room at the White House, on September 6, 2011 in Washington, DC. General Petraeus retired from the U.S. Army last week, and has now become the 20th director of the CIA. (Photo by Mark Wilson/Getty Images)