Gen. David Petraeus speaks after exiting the federal courthouse in Charlotte, North Carolina, on April 23, 2015. He admitted one misdemeanor count of mishandling classified materials and was sentenced to two years of probation and a $100,000 fine. Getty Images

Former CIA director and retired Gen. David Petraeus apologized Tuesday for giving classified information to his biographer-turned-mistress, Paula Broadwell, in 2011. Speaking before the Senate Armed Services Committee, Petraeus -- who resigned when the scandal broke the next year -- said he can't undo the error in judgment, "only say again how sorry I am to those I let down," NBC News reported.

Broadwell, who served in the Army, met Petraeus in 2006 when she was a graduate student and started a case study on the military leader in 2008, according to a USA Today timeline of the pair's relationship. They began an affair shortly after Petraeus became CIA director in 2011 -- at the same time Broadwell was preparing her biography of him, called "All In: The Education of David Petraeus."

After the book's publication in early 2012, one of Petraeus' friends, Jill Kelley, reported a series of harassing emails to the FBI. When authorities investigated, they found Broadwell was the one behind them -- and that she and Petraeus were in a relationship. The FBI later discovered Petraeus had been giving Broadwell black notebooks full of information from his time as the top commander of the International Security Assistance Force in Afghanistan, CNN reported. He resigned in November of that year.

Broadwell, a married mother of two, was not charged for the emails to Kelley. Petraeus, a married father of two, pleaded guilty this April to one misdemeanor count of mishandling classified materials and was sentenced to two years of probation as well as a $100,000 fine, ABC News reported.

Petraeus kept out of the limelight until Tuesday, when he discussed policy for the Middle East before the committee. It was his first time at a public congressional hearing since his resignation, and he opened his speech with the apology.

"Four years ago, I made a serious mistake -- one that brought discredit on me and pain to those closest to me," Petraeus said. "It was a violation of the trust placed in me and a breach of the values to which I had been committed throughout my life."

Broadwell is the director of the Think Broader Foundation, which works for accurate depiction of women in the media, according to her LinkedIn page. She lives in Charlotte, North Carolina, and works for Equipe Broadwell, a management and communications company. Broadwell had not tweeted in response to the Petraeus statement Tuesday morning.