WASHINGTON — A year ago, Marine Capt. M. Matthew Phelps might have been relieved of his command in San Diego if the military found out he was gay. On Tuesday, he stood in a packed Pentagon auditorium and openly discussed his sexuality.

“I happen to be gay, but more importantly, I’m a Marine,” Phelps said as heads nodded and murmurs of approval swept through the standing-room-only crowd of several hundred people.

For the first time in its straight-laced history, the Pentagon thus celebrated Lesbian, Gay, Bisexual, Transgender Pride Month, a stunning cultural milestone that officially recognizes what has always been true — that gays and lesbians serve inside its fortress-like walls and the rest of America’s armed forces.

The ceremony, which was broadcast on an internal TV network to U.S. military bases around the world, was sober and strict — from the rhythmic “hut, hut, hut” of the color guard marching into the auditorium, to pre-taped videos from President Obama and Defense Secretary Leon E. Panetta and a panel discussion on “The Value of Open Service and Diversity.”

It was far from an outre gay pride celebration, like the Manhattan parade this month that one blogger said featured “dancing boys, granny boobs, marching bands, rainbow Storm Troopers, babies, feathers, pasties, thongs — heck, even a bunny in a hat.”

But if most of the Pentagon audience wore crisp military uniforms or conservative business suits, their joy was unmistakable. Several same-sex couples said they were attending their first Pentagon function together.

“It means acceptance,” said Doug Wilson, who stepped down this year as assistant secretary of Defense for public affairs but returned for the event. “It means people can be complete human beings.”

Army Lt. Col. Todd Breasseale, a veteran of combat in Iraq and Afghanistan, attended the ceremony with his partner and called the event “the right kind of step forward. It’s measured. It’s done appropriately. It’s consistent with the way the military does things.”

To be sure, the Pentagon is well behind other federal departments and agencies in observing gay pride month. The civilian Central Intelligence Agency, for example, has celebrated it for the last dozen years, officials said. And Obama recently announced that he supports gay marriage, the first president to do so.

The Pentagon celebration came nine months after the formal end of “don’t ask, don’t tell,” a 17-year-old law that barred gays and lesbians from serving openly in the military. Over the years, thousands were expelled. Openly gay civilian employees at the Defense Department faced similar discrimination until 1995 because they often could not obtain security clearances needed to work in national security agencies.

A gay Army officer in the audience said he was angry that none of the service chiefs — the uniformed heads of the Army, Navy, Air Force and Marines — attended the ceremony. He also noted that civilians in the audience outnumbered members of the military by a large margin.

Yet the Pentagon is changing in ways that were unimaginable only months ago.

Last Saturday, a Navy chaplain at Joint Base McGuire-Dix in New Jersey performed what officials believed to be the first same-sex civil union ceremony at a U.S. military base. The ceremony joined an Air Force enlisted airman and his civilian partner.

Under pressure from gay rights groups, the Pentagon is looking at broadening benefits for same-sex couples. For now, they lack equal access to military housing, medical care and other benefits available to heterosexual couples.

Opponents said the Pentagon’s ceremony showed the Obama administration was pressing an extreme gay rights agenda because it could help his reelection campaign.

“The Pentagon is now honoring something that a year ago was a court-martial offense, and that’s a radical shift,” said Ron Crews, a retired Army Reserve chaplain. Crews heads a group called Chaplain Alliance for Religious Liberty, which backs a proposed law that would block same-sex marriages on military bases.

But the audience offered nothing but applause Tuesday when Phelps, who enlisted after the terrorist attacks of Sept. 11, 2001, stood on stage by a U.S. flag and recounted how his life had changed after more than a decade in the Marines.

When his unit deployed to Iraq, fellow officers would share stories about their families or girlfriends, he said.

“I’d sit in the back of the room, not talking to anybody,” he said. “When everybody else was getting together … I was actually growing more distant from my unit.”

He kept quiet until September, when the “don’t ask, don’t tell” law was rolled back. The next day, Phelps went to work at the Marine Corps Recruit Depot in San Diego expecting questions from fellow Marines about whether he was gay.

“Nobody asked,” he said.

This month, Phelps was invited to the White House for a gay pride reception that Obama hosted.

“I thought to myself how amazing it is,” Phelps told the crowd. “Over the course of a year, I could go from being fired for who I am to having champagne with the commander in chief.”

david.cloud@latimes.com