WASHINGTON, Jan 24 (Reuters) - Three years before he lifted the U.S. military's ban on females in front-line combat, Leon Panetta grew acutely aware that women in senior positions were already risking - and losing - their lives when a would-be informant blew himself up at a CIA base in Afghanistan.

Panetta was CIA director at the time of the December 2009 attack in Khost, Afghanistan, and two women -- including one who headed the CIA base -- were among the seven Americans killed.

A senior aide cited it among the experiences that helped shaped Panetta's thinking about women in war even before he took over the Pentagon in 2011, and inherited the difficult job of writing condolence notes to the families of fallen troops - men and women.

More than 150 women have died in the wars in Afghanistan and Iraq since 2001, and nearly 1,000 have been wounded.

"Every time I visited the war zone ... I've been impressed with the fact that everyone -- everyone, men and women alike -- everyone is committed to doing the job," Panetta told reporters on Thursday.

"They're fighting and they're dying together. And the time has come for our policies to recognize that reality."

So, with perhaps just weeks before he steps down as defense secretary and retires to private life, Panetta on Thursday was able to seal his legacy as the man who lifted the 1994 ban on women in front-line combat roles. It came after he helped finish the job of integrating openly serving gay and lesbian service members in 2011, with the elimination of the "Don't Ask, Don't Tell" policy.

Panetta took an important step toward making more opportunities available to women last year, with an initial move to open around 14,000 additional jobs to women but leaving more than 230,000 off-limits. At the time, the aide recalled Panetta being unsatisfied, asking privately "why can't we do more?"

Panetta on Thursday credited the military's top brass for putting forward the proposal this month to lift the ban on women in front-line combat roles. An OK from the generals and admirals was crucial buy-in that would be necessary for the proposal to work. The integration will be gradual, through 2016, and it's unclear which roles may remain off-limits.

"I was very pleased when I got that recommendation, because it was a fulfillment of what we had talked about and what we wanted to achieve," Panetta said.

OBAMA STAYED OUT OF PENTAGON DELIBERATIONS

Aides described regular meetings over the past year with service chiefs on the issue, sometimes in the ultra-secure Pentagon briefing room known as "The Tank."

Panetta said he also regularly spoke with President Barack Obama on his efforts to provide more opportunities to women.

A senior administration official said Obama had privately encouraged Panetta to take the step but had stayed out of internal Pentagon deliberations.

Panetta also had an ally in General Martin Dempsey, the top U.S. military officer, who, as commander of the 1st Armored Division in Iraq in 2003 came to learn how the role of women in the military had changed over the years.

On his first foray out of the forward operating base, Dempsey jumped into an armored vehicle and slapped the soldier manning the turret gunner around the leg, and said, "Who are you?"

"And she leaned down and said, 'I'm Amanda,'" Dempsey recalled. "So, female turret-gunner protecting (me, the) division commander. And it's from that point on that I realized something had changed, and it was time to do something about it."

Panetta described a similar experience when he came face-to-face with a military that had changed tremendously in the near half-century since he joined the Army as an intelligence officer in 1964.

"It's been almost 50 years since I served in the military and to go out now and to see women performing the roles that they are performing and doing a great job at it, I think it ... encouraged me," Panetta told reporters.

He noted that he had six grandchildren, half of them women and the other half men.

"I want each of them to have the same chance to succeed at whatever they want to do," he said.

"In life, as we all know, there are no guarantees of success. Not everyone is going to be able to be a combat soldier. But everyone is entitled to a chance." (Additional reporting by Steve Holland and David Alexander; Editing by Warren Strobel and Doina Chiacu)

We welcome comments that advance the story through relevant opinion, anecdotes, links and data. If you see a comment that you believe is irrelevant or inappropriate, you can flag it to our editors by using the report abuse links. Views expressed in the comments do not represent those of the Thomson Reuters Foundation. For more information see our Acceptable Use Policy.