It was a polite protest, the women wearing dresses and heels, the men in dark suits and ties. But when John James stepped onto Independence Mall on that hot July Fourth in 1965, he had a lot to lose.

Being identified as gay - much less taking part in a public protest - could bring jeers, insults, and punches.

He could be fired from his job if people knew he was gay.

Psychiatrists then classified homosexuality as a mental illness, one that demanded a cure - electric shock therapy, or even lobotomy.

Still, James carried a placard onto the sidewalk near Independence Hall, joining 40 others in one of the nation's first major demonstrations to demand equal rights for gay people.

"I just figured, it's a good thing to do," said James, now 74 and living in Center City. "I was apprehensive. . . . I was concerned about the possibility of violence, although nothing like that happened."

This week, people from across the country are coming to Philadelphia to celebrate the 50th anniversary of that demonstration, seen by many as the birth of the modern gay-rights movement. The five-day event begins, coincidentally, days after the Supreme Court ruling that allowed same-sex couples to wed across the nation.

"Look at how far we've come in 50 years," said Mark Segal, publisher of the Philadelphia Gay News.

The observance will feature panel discussions, a screening of the documentary Gay Pioneers, history exhibits, parties, and concerts, with most events taking place on or near Independence Mall.

Traveling to Philadelphia are constitutional scholars, veteran activists, religious leaders, and elected officials. The comedian Wanda Sykes will be here. So will the parents of Matthew Shepard, whose 1998 murder spurred hate-crime legislation and a national discussion on how gays were treated.

On Thursday, James Obergefell, the lead plaintiff in the Supreme Court case, will launch the commemoration by laying a wreath at the plaque, at Sixth and Chestnut Streets, that marks the site of the first protest.

On Friday, an American flag will be placed at the Tomb of the Unknown Revolutionary War Soldier in Washington Square by Eric Alva, a third-generation Marine who lost a leg in the Iraq War, and John Holmes III, a distant relative of President George Washington. Both men are gay.

Generally, the start of the gay-rights movement is considered to be the Stonewall Inn riot in New York City in 1969. But four years earlier, Philadelphia was the site of the largest demonstration for gay equality.

The protests continued each year through 1969, called "Annual Reminders." They sought to remind the country that the promise of the words engraved on the Liberty Bell - "Proclaim liberty throughout all the land unto all inhabitants thereof" - did not apply to everyone.

More than size made the first protest important, said Malcolm Lazen, executive director of Equality Forum and chair of the National LGBT 50th Anniversary Celebration.

It was the first to draw participants from multiple cities - Philadelphia, New York, and Washington. It was the first to demand equality, instead of, for instance, better treatment by police. It included organizers Barbara Gittings and Frank Kameny, now remembered as the mother and father of the gay-rights movement.

Most important, it was repeated every year, the last time on July 4, 1969 - six days after Stonewall exploded.

"There's a total misconception that the movement started at Stonewall," Lazen said. "It's like saying the American Revolution started at the Boston Tea Party, and forget about Thomas Jefferson and Ben Franklin and all those other folks."

Why here? Why not in the big media center of New York, or in the nation's capital?

Philadelphia seems an unlikely choice - in July 1965 it was a pugnacious union town that was struggling to hold onto a failing industrial base. Tough-guy cop Frank L. Rizzo was about to become police commissioner and soon afterward would be elected mayor.

It was also a place in social turmoil. A swath of North Philadelphia had burned in the Columbia Avenue riot a year earlier.

Two months before the gay-rights march, protesters had marched to desegregate Girard College. The Rev. Dr. Martin Luther King came to the city in August.

Temple University professor Gary Mucciaroni, author of Same Sex, Different Politics: Issues and Institutions in the Struggle for Gay and Lesbian Rights, said it's important to note how poorly gays were regarded then. Society saw them as outcasts and deviants, often lumped with communists as people of suspect allegiance.

Among all potential protest sites, only Philadelphia had Independence Hall and the Liberty Bell, two abiding symbols of freedom - and the means to link the aspirations of gays to the ongoing struggle for individual liberty. By marching at the most American of places on the most American of days, gays worked to bind themselves to the nation's best traditions.

At the time, he noted, the civil rights movement was in full cry, and gays borrowed a page from its playbook to seek their own greater liberty.

Many of the marchers' supporters thought they were making a mistake by going public. The federal government would not hire gays. Forty-nine states - Illinois was the exception - made private, consensual homosexual acts a criminal offense.

The threat of being classified as mentally ill was real. Among the items at the National Constitution Center exhibit "Speaking Out for Equality" are doctors' tools used for lobotomies.

"I didn't think, and I don't think most of the people in the movement ever thought, we would see such astonishing progress," said Paul Kuntzler, 75, who came to Philadelphia from Washington on that day in 1965. "That there would be laws protecting us, that we could serve openly in the military, that we could get married."

Kuntzler remembers the mall as extremely quiet. No passersby said anything derogatory.

Three months earlier, when he and nine members of the "homophile community" demonstrated outside the White House, it seemed like every press photographer in Washington showed up. People gaped and frowned at the marchers.

James, also then living in Washington, arrived in Philadelphia by bus. At 24, he neither concealed nor announced his sexuality.

Not many people were on the mall, despite the holiday, he recalled. The protest had not been publicized in advance. He asked news photographers at the scene not to take his photo, but they did.

Today, that picture is easily found on the Internet. He's the tall man in a suit, carrying a sign that reads, "Homosexual Citizens Want Their Right to Make Their Maximum Contribution to Society."

At the time, he thought the protest would be a small step in a long journey, not something that would be remembered 50 years later. It turns out that people are more interested in what occurred on one afternoon of his life than in all the rest of his years.

"I took a break to get ice cream from a vendor," James recalled. "He said something like, 'There were some things I never thought I would be doing' - he meant doing business with known homosexuals. But he sold me the ice cream and didn't seem to mind it."

Schedule of 50th-anniversary events: http://lgbt50.org/

@JeffGammage