Retired U.S. Army general David H. Petraeus arrives at a Senate Armed Services Committee in September 2015. (Mark Wilson/Getty Images)

Defense Secretary Ashton B. Carter has decided not to impose any further punishment on David H. Petraeus, the former CIA director and retired Army general who was forced to resign in a sex-and-secrets scandal in 2012.

In a brief letter sent Friday to the leaders of the Senate’s Armed Services Committee, the Pentagon reported that Carter had agreed with the Army’s recommendation not to discipline Petraeus.

“Given the Army review, Secretary Carter considers this matter closed,” Stephen C. Hedger, assistant secretary of defense for legislative affairs, wrote in the three-sentence letter, obtained by The Washington Post. The letter did not elaborate.

The Pentagon letter was addressed to Sen. John McCain (R-Ariz.) and Sen. Jack Reed (D-R.I.), the chairman and top Democrat, respectively, of the Armed Services Committee.

In his first public testimony since resigning as CIA director, former Army Gen. David Petraeus apologized to the Senate Armed Services Committee for his affair. (AP)

In a public letter of their own on Jan. 20, the senators had urged Carter to let the Petraeus matter lie and allow him to keep the four-star rank he had earned during his long career in the Army.

In April, after a lengthy investigation by the FBI that disgraced the onetime military hero, Petraeus pleaded guilty in federal court in North Carolina to a misdemeanor charge of mishandling classified materials. He was sentenced to two years of probation and fined $100,000.

Petraeus’s civilian sentence did not necessarily exempt him from further punishment at the hands of the military. Under the Uniform Code of Military Justice, although he retired from the Army in 2011 to take the top job at the CIA, he still could have faced discipline for his actions.

Carter could have imposed a range of disciplinary measures, under military law, from issuing a nonbinding letter of concern about Petraeus’s actions to demoting him from his rank as a retired four-star general.

Besides further tarnishing Petraeus’s reputation, stripping him of a star could have cost him tens of thousands of dollars a year in pension payments.

Carter’s decision effectively ends a long and embarrassing period of uncertainty for Petraeus, one of the Army’s most venerated leaders before his reputation was shredded by the scandal.

On Saturday, Petraeus’s attorney, David Kendall, declined to comment on the outcome of the case.

As part of Petraeus’s plea deal with the Justice Department, he admitted in a signed statement that he had committed wrongdoing while he was still in the Army before he retired in 2011 to take charge of the CIA.

He also admitted that he lied to FBI agents.

Specifically, Petraeus acknowledged providing eight notebooks containing highly classified material to his biographer, Paula Broadwell, in the waning days of his Army career. Petraeus has also admitted to having an affair with Broadwell.

Petraeus had kept the notebooks when he served as commander of U.S. and NATO forces in Afghanistan in 2010 and 2011. They contained code words, war strategy, the names of covert officers and other sensitive information. In addition, they outlined deliberative discussions with the National Security Council and President Obama.

Broadwell was not charged in that federal investigation. She is still an officer in the Army Reserve, and a senior Army official has said that the service was not contemplating taking action against her.

The Justice Department shared its investigative case file on Petraeus with the Army after his guilty plea, and some Justice Department officials made little secret of their desire for the military to take further action against the former spymaster.

After a review, however, then-Army Secretary John McHugh made a formal recommendation in the fall that Carter take no further action in the case. McHugh issued the recommendation as one of his final acts in office before he stepped down as Army secretary Nov. 1.

Petraeus remains a revered figure within the Army for his leadership during the wars in Iraq and Afghanistan. Despite the scandal that led to his downfall at the CIA, he also maintains close ties with many influential members of Congress.