Discuss as:

US officials: Complaint about Broadwell sparked FBI investigation that indicated Petraeus affair

Gen. David Petraeus' resignation from the highest levels of government service started with a seemingly unrelated complaint to the FBI. NBC's Andrea Mitchell reports.

"He's not perfect, he's made a mistake," said Steven Boylan, who worked for Gen. David Petraeus before the CIA director resigned following the discovery of his extramarital affair. NBC's Kristen Welker reports.

An FBI investigation into a complaint about Paula Broadwell, who authored a biography of Gen. David Petraeus, turned up emails indicative of an extramarital affair between the writer and the general, senior law enforcement officials and government officials familiar with the investigation told NBC News.

Petraeus, widely respected for his leadership, strategic acumen and reputation as a straight shooter, sent shock waves through Washington on Friday by resigning as director of the CIA, ending a career of nearly four decades in intelligence, citing an extramarital affair.

The FBI’s involvement began when a woman turned to the bureau for help after receiving what she considered harassing emails, the officials said. The officials did not name the woman, but stressed she was not Petraeus’ wife or a family member.

The FBI soon discovered that the emails were coming from Broadwell, which in turn led to the discovery that Broadwell was sending explicit emails to Petraeus, according to the officials.

At first, investigators were concerned that a stranger had somehow hacked into Petraeus’ email account, but then learned that his emailing her was consensual and indicative of an affair, they said.

One senior law enforcement official, who had been aware of the probe for several weeks, said the complaint to the FBI about Broadwell's behavior "raised concerns, and we had to check it out. It wasn't apparent at first what was going on."

"That clarified our concern. We had to talk to him," the official said. "He made the decision to tell the White House. We handled it discreetly." The FBI did not tell the White House about the findings, as some sources had suggested Friday night, the official added.

Broadwell had extensive access to Petraeus while writing a biography of the general, "All In: The education of General David Petraeus," and had given numerous television interviews speaking about him.

NBC's Kristen Welker looks at the days leading up to Friday's stunning announcement by Gen. David Petraeus.

Investigators concluded that there was no criminal violation, law enforcement sources told NBC News.

Agents interviewed Petraeus in late October, the senior law enforcement official said.

Asked about criticism from some on Capitol Hill that the FBI didn’t tell members of the intelligence committees about this sooner, the official said investigators determined "this was not an intelligence matter. It did not fall on that side of things."

Broadwell could not be reached for comment.

Pete Williams is NBC News' justice correspondent. Andrea Mitchell is NBC News' senior foreign affairs correspondent.

More content from NBCNews.com:

Follow US news from NBCNews.com on Twitter and Facebook