Scott G. Brown is an author and one of the oldest survivors of the 1969 Stonewall Riots.

Protesters clash with police in Philadelphia on Thursday, April 30, 2015. The event in Philadelphia follows days of unrest in Baltimore amid Freddie Gray’s police-custody death. (AP Photo/Matt Rourke)

President Obama summarized popular opinion this week when he declared “there’s no excuse” for the violence in Baltimore. “It is counterproductive,” he said. National media have largely followed that perspective, pressuring local leaders to condemn rioters and grilling officials to explain how peaceful protests got out of hand. A woman caught on video stopping her son from joining in the riot was widely praised in headlines as “Mother of the Year.” Even members of the Baltimore Ravens, who are paid millions to be violent on the football field, insisted that “violence has never been the answer.”

But the truth is, violence sometimes has been the answer. I know, because I have witnessed it myself. I was a part of the LGBT community that began the Stonewall riots in 1969, the violent uprising that launched the gay rights movement. I was dancing with my then-partner at the Stonewall Inn in New York City’s Greenwich Village when police raided the bar in the early morning of Saturday, June 28.

Much like the Baltimore protesters, gay and trans people at that time were tired of police harassment and of having our grievances dismissed by society. Police had regularly raided gay bars for decades, looking to trap people for sodomy “crimes” or other minor infractions. Even as public views of homosexuality softened in the 1960s and sodomy laws were gradually abolished, police continued to target us. We were criminalized for simply living our own lives in our own neighborhoods.

Stonewall was one of my favorite places to go out dancing. The bar served diluted drinks, and there was no running water, but the dance floor stayed packed and the crowd was fun. That fateful night, my partner and I arrived in matching collared shirts and peeked through the peephole to let the bouncer know we were regulars. We had been dancing with the drag queens for a couple of hours when the police showed up and unplugged the jukebox. They demanded that we line up along the wall and show our IDs, threatening to arrest anyone who didn’t comply. The officers went from person to person, a 45-minute process during which we all were forced to stay inside and await our fates.

My obedience kept me out of handcuffs, and the officers eventually let some of us go. But once outside, we saw that a crowd had started to congregate, clearly agitated by the latest harassment of the LGBT community. As the police started bringing people out in cuffs, the crowd became enraged. The officers were manhandling the drag queens, hitting their backs with billy clubs to force them into the paddy wagons. One drag queen elbowed an officer in the groin while another threw a shoe. That’s when the crowd started retaliating, too. Bottles, garbage can lids, pennies, stones — anything people could get their hands on — started flying in every direction. I sympathized with the crowd’s anger, but my partner and I left before the riot grew to a reported 400 people.

Still, we didn’t escape the police harassment. I drove my partner to a nearby Orange Julius, where we grabbed some hot dogs. While we were sitting in the car, a couple of officers approached us and demanded to see our drivers’ licenses. My partner didn’t have one, so they handcuffed him and forced him to spend the evening in jail. The next morning, a judge threw out his case. But the police had sent a clear message — members of the gay community would continue to be harassed until they stood up for themselves. The Stonewall riot continued for four more days.

The story of that night is strikingly similar to the one we’re hearing today: A marginalized community, tired of unnecessary police harassment and brutality, was pushed to a breaking point. The riot destroyed the Stonewall Inn, and when the police retreated into the bar, some in the crowd tried to set the building on fire. That’s not the last time the gay community lashed out violently at a system that seemed intent on treating them unjustly. In 1979, when the man who killed Harvey Milk — San Francisco’s first openly gay elected official — was sentenced to just seven years in prison, thousands of rioters descended on City Hall, breaking windows and setting police cars aflame.

It’s that violence that landed the grievances of the LGBT community on the front pages of newspapers. It’s that violence that ignited the gay rights movement. The spontaneous Stonewall uprising changed the course of history, ultimately leading to a series of social and legislative successes that have improved the lives of LGBT Americans, most recently the legalization of same-sex marriages in 37 states and the District of Columbia.

Of course, that’s not to say that all violence is good. There are nonviolent ways to influence change, and it’s far better to achieve social progress through official systems, without threatening others’ safety and property. The most lauded figures in our history were those who have helped humanity progress with peace and empathy. More often than not, violence only begets more violence. But it’s wrong to say that violence is always ineffective.

At several points in our nation’s history, riots and uprisings have driven attention to injustice and resulted in long overdue social change. The Boston Tea Party and Stamp Act Riots precipitated the American Revolution. U.S. slave revolts galvanized the abolitionist movement. And while the Rev. Martin Luther King Jr. is remembered as a nonviolent activist, it was the violence on the streets of Selma, Ala. — when the marchers King led were attacked by police with dogs and sprayed with water hoses — that ultimately focused the nation’s attention on civil rights efforts in the South. The brutality that people endured that day was horrific, but those images on television screens across America led to the passage of the 1964 Voting Rights Act. In fact, it was King who said, “A riot is the language of the unheard.

The violence seen in the Baltimore this week stemmed from many years of police brutality, poverty and caged unrest. The majority of the brave protesters in Baltimore were, indeed, peaceful. But it wasn’t until violence broke out that many news outlets focused on the city and the public started really paying attention. We don’t yet know what good, if any, will come from the uprising in Baltimore. But it’s clear that people there are similar to New York’s LGBT community in the 1960s: An oppressed community whose voice has been unheard for generations, and for whom unrest is the last option.

More from PostEverything:

We shouldn’t condone the Baltimore riots, but let’s stop calling them ‘senseless.’

Why is America celebrating the beating of a black child?

What caused the Ferguson riot exists in so many other cities, too