FILE - In this March 30, 2009 file photo, U.S. President Barack Obama meets with then U.S. Envoy for Sudan Major General J. Scott Gration in the Roosevelt Room of the White House in Washington. The U.S. ambassador to Kenya Scott Gration said Friday, June 29, 2012 that he is leaving his post over differences with Washington on his leadership style. (Evan Vucci/AP)

The U.S. ambassador to Kenya, J. Scott Gration, a close adviser and friend of President Obama, announced his resignation Friday, weeks before the scheduled release of a U.S. government audit highly critical of his leadership at the embassy.

Gration did not provide specific reasons for moving on from what he described as “his dream job.” But in an e-mailed statement, he said that “differences with Washington regarding my leadership style and certain priorities lead me to believe that it’s now time to leave.”

The audit by the State Department Office of Inspector General found that Gration repeatedly violated diplomatic security protocols at the embassy by using unsecured Internet connections despite warnings, according to a former State Department Africa Bureau official who has seen a draft of the report.

Embassy staffers complained about his lack of interpersonal skills and confrontational style, which generated low morale, the former official said.

A former major general in the Air Force, Gration had prided himself on his leadership and team-building skills, and his staff’s perceptions of him were a huge blow, the former official said, speaking on the condition of anonymity because he still works in Washington.

Gration, who became ambassador 13 months ago, said in his statement that the diplomatic assignment had been “the perfect opportunity to use my deep-rooted knowledge of Kenya — its people, its language, and its culture — and my diplomatic, development, security, and humanitarian experience.” He said he would deeply miss Kenya and its people.

“I am very proud of my 35-year career of dedicated and honorable service to our great nation, leading at all times with integrity first and the highest ethical standards,” he said.

A request for additional comment sent to Gration’s personal e-mail address was not returned.

The security violations could have resulted in Gration losing his government security clearance, preventing him from holding a position in the State Department. “You cannot be a U.S. ambassador without a security clearance,” the former official said.

State Department spokeswoman Victoria Nuland said the inspector general’s report was part of a routine inspection of the embassy, but she declined to comment on its contents. “We wish him well as he moves into private life,” she said.

Gration’s resignation is not the first time a U.S. ambassador has stepped down ahead of a scathing inspector general’s report. Last year, Cynthia Stroum, a venture capitalist and major fundraiser for Obama, left her position as U.S. ambassador to Luxembourg after the report found that her “confrontational management style” had brought the embassy “to a state of dysfunction.”

Kenya, an economic powerhouse in East Africa, is a close U.S. ally in the fight against terrorism, particularly against the al-Qaeda-linked al-Shabab militia in neighboring Somalia.

A U.S. Embassy advisory last week warning of an imminent terrorist attack in Kenya’s southern port city of Mombasa stirred tension between Nairobi and the State Department. Worried that the warning could further harm its tourism industry and economic growth, the Kenyan government publicly described it as “economic sabotage.”

Two weeks ago, Gration was visited in Kenya by the administration’s highest-ranking diplomat on Africa, Assistant Secretary of State Johnnie Carson, a career foreign service officer who served as ambassador to Kenya from 1999 to 2003. Carson first visited Somalia, the highest-ranking U.S. official to do so in nearly two decades.

The son of missionaries, Gration grew up in what is now the Democratic Republic of Congo and speaks Swahili, widely spoken in Kenya and other parts of East Africa.

He spent most of his Air Force career as a fighter pilot, then rose through the ranks to become director of strategy and planning under Marine Gen. James L. Jones, who at the time was NATO’s supreme allied commander.

Gration was assigned to brief then-Sen. Barack Obama and later was asked to accompany Obama as military liaison on a formative trip to Africa. They spent three weeks traveling through South Africa, Kenya, the Darfur refugee camps in Chad and the U.S. military installation in Djibouti.

A few months after the trip, Gration retired from the military and joined the Democratic Party and Obama’s campaign. Gration was a close adviser who was said to have greatly influenced Obama’s thinking about Africa; he later became a special assistant to the president.

From March 2009 to April 2011, Gration was the U.S. special envoy to Sudan. He spawned controversy over his soft-handed leadership style in dealing with the repressive Khartoum government, led by Omar Hassan al-Bashir, who had been indicted on war-crimes charges.

Gration at the time called his approach pragmatic, but critics, including Democratic and Republican members of Congress, charged that Bashir’s government was manipulating him. They argued that Bashir and his top advisers respond only to pressure, particularly tough multilateral sanctions against Sudan. But Gration preferred a more conciliatory approach, using carrots over sticks.

“We’ve got to think about giving out cookies,” Gration told a Washington Post reporter in September 2009. “Kids, countries — they react to gold stars, smiley faces, handshakes, agreements, talk, engagement.”

Karen DeYoung in Washington contributed to this report.