The Justice Department is declining to prosecute a former high-ranking U.S. diplomat who was investigated by the FBI on suspicion of providing secrets to the Pakistani government, according to U.S. law enforcement officials.

The diplomat, Robin L. Raphel, was at the center of a counterintelligence investigation, which became public after agents raided her Washington home in 2014.

FBI agents found classified information in the search, but the materials were many years old, according to former U.S. law enforcement officials familiar with the investigation. The officials spoke on the condition of anonymity to discuss the matter.

[Robin Raphel, the State Department veteran, caught in a Pakistan intrigue]

At the time of the raid, Raphel had retired from the Foreign Service but was working for the State Department. The State Department declined to renew her contract and her security clearances were pulled, impeding her ability to find other work.

The 68-year-old Raphel was among the U.S. government’s most senior advisers on Pakistan and South Asian issues. She is a former assistant secretary of state for South Asia and a former ambassador to Tunisia.

The Justice Department notified Raphel on Monday of its decision not to prosecute her.

Former and current U.S. law enforcement officials were skeptical that the Justice Department would bring charges against her because of what happened in the case of former CIA director and retired four-star general David H. Petraeus.

In that case, Petraeus provided his biographer with eight notebooks containing highly classified details, but pleaded guilty to a misdemeanor charge of mishandling classified information under a deal with the Justice Department.

Many FBI agents were angered by the outcome, believing it would taint future counterintelligence cases.

Amy Jeffress, Raphel’s attorney and a former senior Justice Department official, refused to make a deal with prosecutors. She insisted her client not be charged with any crime, according to a person familiar the negotiations.

The information the FBI found at Raphel’s house had nothing to do with the current investigation and dated to before her retirement in 2005. Some of the information was decades old.

In a statement, Jeffress, of the Arnold & Porter law firm, said she was pleased that the Justice Department declined to prosecute.

“It was clear from the outset that this investigation was based on a fundamental misunderstanding,” Jeffress said. “The department has now completed a lengthy investigation that has fully exonerated Ambassador Raphel of the allegations that anonymous government officials irresponsibly leaked to the press nearly two years ago.”

Her attorney added: “It is of the utmost importance to our national security that our diplomats be able to do their work without fearing that their routine diplomatic communications will subject them to criminal investigation.”

A Justice Department spokesman declined to comment.

FBI agents began investigating Raphel after the U.S. intercepted the communication of a Pakistani official that raised serious suspicions that Raphel may have been spying on behalf of that government. Months later, the FBI searched her office and home.

The investigation made headlines and shocked many of her colleagues at the State Department and friends who found it hard to believe the veteran diplomat would betray her country.

Raphel began her career as a CIA analyst and served 30 years in the Foreign Service. Her former husband, Arnold L. Raphel, was the U.S. ambassador to Pakistan. He was killed in a 1988 plane crash with Gen. Mohammed Zia ul-Haq, then the president of Pakistan.

She returned to the State Department in 2009 to work as an adviser.

Former diplomats say the nature of their work is talking to foreign adversaries and sharing information at times.

Jeffress said she intends to work with the State Department and Justice Department to help “avoid such mistreatment of career diplomats in the future.”

Matt Zapotosky contributed to this report.