The Defense secretary was determined to lift the ban on women in combat before leaving his post.

WASHINGTON — Leon E. Panetta was an obscure government lawyer in 1970 when President Nixon's administration forced him to resign for enforcing civil rights and equal education laws too aggressively — an episode that helped launch his political career.

On Thursday, he signed an order at the Pentagon to allow women to serve in ground combat units for the first time in U.S. military history, a goal that aides say he was determined to accomplish before stepping down as secretary of Defense.

In many respects, removing the last legal gender barrier in America's armed forces falls into the same category as the desegregation of the military after World War II. Panetta's order transforms an institution that had excluded women from some of the most dangerous jobs — and thus blocked them from promotion to higher ranks.

"Today, every American can be proud that our military will grow even stronger with our mothers, wives, sisters and daughters playing a greater role in protecting this country we love," President Obama said in a statement.

He said he had called Panetta to express his "strong support for this decision."

At 75, Panetta is perhaps best known as the CIA director who presided over the military raid that killed Osama bin Laden in May 2011. He was memorably portrayed as a foul-mouthed, steely leader by James Gandolfini in the Oscar-nominated film "Zero Dark Thirty." He had been elected to Congress nine times as a Democrat from Monterey, and was a highly regarded budget director and White House chief of staff under President Clinton.

But his decision to stop barring hundreds of thousands of women from combat jobs may be the most personally satisfying for the son of Italian immigrants who talks in almost every speech about expanding opportunities for future generations.

"One of my priorities … has been to remove as many barriers as possible for dedicated and qualified people to be able to serve their country in uniform," he told reporters at the Pentagon minutes before signing the order.

The job of integrating women more fully will fall to Panetta's successor, former Sen. Chuck Hagel (R-Neb.), assuming he wins Senate confirmation after hearings that begin Jan. 31, and especially to the armed services themselves. Although the American public increasingly opposes discrimination based on gender and sexual orientation, the task is likely to prove difficult and lengthy.

"This will be a significant change … a bigger impact and a more significant cultural stretch on the services, particularly the Army and Marines," said retired Lt. Gen. David Barno, former commander of the U.S.-led coalition in Afghanistan.

Anthony Cordesman, a defense expert at the nonpartisan Center for Strategic and International Studies, compared the challenge to President Truman's 1948 executive order to desegregate the military. It took the wars in Korea and Vietnam to produce truly integrated fighting units, and it may take a decade or longer for women to crack into elite infantry units.

"There's still a lot to be done, but this is not the America of 1950. It's not the America of 2000, for that matter," Cordesman said. "And you have to say that in both cases it's a better America."

An Army intelligence officer during the 1960s, Panetta represented Ft. Ord in Congress, and one of his sons was in the Naval Reserves. But he had little daily contact with the operational military until he was appointed in 2006 to the Iraq Study Group, a congressionally mandated panel formed to suggest options for turning around the failing war in Iraq.

In briefings and in trips by panel members to Iraq, Panetta noticed the increasing role that female soldiers and Marines played in the conflict, according to an aide. When Obama named him to head the CIA in 2009, women comprised nearly half of the agency's workforce and were playing key roles in many counter-terrorism operations, including the hunt for Bin Laden. Panetta was also deeply affected by a suicide attack on a CIA base in eastern Afghanistan in December 2009 that killed seven officers, including two women, an aide said.

When he arrived at the Pentagon in July 2011, Congress already had repealed the so-called "don't ask, don't tell" law that barred gays and lesbians from serving openly. It fell to Panetta to formally end that ban, which the Marine commandant and several other senior officers initially wanted to preserve.

They came to support the repeal, despite warnings from some Republican lawmakers that it would harm military readiness, especially in combat units. Today, even former critics of the change say those fears have proved unfounded. That encouraged Panetta and his team to push ahead with other sweeping social changes.

In early 2012, Panetta opened about 14,500 combat positions to women, allowing them to be assigned to support jobs at the battalion level in the Army and Marines. His spokesman, George Little, promised publicly that more changes were coming.