Former President Barack Obama on Monday published a piece on Medium addressing the nationwide protests in the wake of the death of George Floyd -- laying out his ideas for how the country “can sustain momentum to bring about real change,” while also deriding the violence and looting that have occurred on the fringes of some demonstrations.

“The waves of protests across the country represent a genuine and legitimate frustration over a decades-long failure to reform police practices and the broader criminal justice system in the United States,” Obama wrote. “The overwhelming majority of participants have been peaceful, courageous, responsible, and inspiring. They deserve our respect and support, not condemnation.”

Thousands of people have gathered in cities across the country over the last few days to protest the police brutality and racial injustice following the death of Floyd, the Minneapolis man who died in police custody May 25 after Officer Derek Chauvin pinned down Floyd and kneeled on his neck for more than 8 minutes in a moment caught on cellphone video.

Chauvin, who was fired from the force along with three other officers involved in the incident, was charged late last week with third-degree murder and second-degree manslaughter. He also was accused of ignoring another officer who expressed concerns about Floyd.

OBAMA SPEAKS OUT ON GEORGE FLOYD’S DEATH: ‘THIS SHOULDN’T BE NORMAL IN 2020 AMERICA’

In his post, Obama countered the argument made by some protesters that demonstrations will facilitate more societal change than voting.

“I’ve heard some suggest that the recurrent problem of racial bias in our criminal justice system proves that only protests and direct action can bring about change, and that voting and participation in electoral politics is a waste of time,” he wrote. “I couldn’t disagree more.”

Obama added: "The point of protest is to raise public awareness, to put a spotlight on injustice, and to make the powers that be uncomfortable… But eventually, aspirations have to be translated into specific laws and institutional practices — and in a democracy, that only happens when we elect government officials who are responsive to our demands.”

The country’s first black president is himself no stranger to widespread – sometimes violent – protests following the killing of a black man by police officers. Obama was in the White House when protests rocked the towns Ferguson, Mo., and Baltimore following the shooting death of Michael Brown by a police officer and the in-custody death of Freddie Gray, respectively.

CLICK HERE FOR THE FOX NEWS APP

While the former president said that the current protests stem from a “legitimate frustration over a decades-long failure to reform police practices,” he roundly condemned the vandalism, looting and violence that has, in part, overshadowed the more peaceful aspects of the protests in many cities.

Despite many protests occurring without incident, there was widespread looting and property destruction over the weekend in cities from New York and Philadelphia to Santa Monica and Seattle. The unrest led to more than 30 cities across the nation declaring curfews over the weekend.

“The small minority of folks who’ve resorted to violence in various forms, whether out of genuine anger or mere opportunism, are putting innocent people at risk, compounding the destruction of neighborhoods that are often already short on services and investment and detracting from the larger cause,” Obama wrote.

He added: “So let’s not excuse violence, or rationalize it, or participate in it. If we want our criminal justice system, and American society at large, to operate on a higher ethical code, then we have to model that code ourselves.”