Senators Cory Booker of New Jersey and Bernie Sanders of Vermont, both likely presidential candidates, spoke to the attendees after attending an early-morning prayer service and marching with N.A.A.C.P. leaders to the capitol. It is an annual rite that began in 2000 as a protest of the flag that once flew above the statehouse dome.

The day was drenched in history. The church that hosted the service, Zion Baptist, was poised to host Dr. King in the spring of 1968, but he postponed a trip there to remain with striking sanitation workers in Memphis, where he was assassinated.

When the procession arrived at the capitol on Monday, a handful of speakers were blaring Dr. King’s oratory from the foot of a monument to Confederate soldiers, the last site of the Confederate banner.

The two senators used their remarks to hail Dr. King, each in a way that foreshadowed their likely campaign messages.

Mr. Booker summoned the pastor’s words and those of other African-American icons to challenge the mostly black crowd to emulate Dr. King’s determination. “What is important is that we apply the ideals of Martin Luther King,” said the senator, adding: “Our dissatisfaction has to turn in action.”

But he also warned against using vitriol toward political adversaries.

Mr. Sanders sought to link his signature call for “a political revolution” with the life of Dr. King.

“King had a revolutionary spirit, yes, he was a revolutionary,” Mr. Sanders said before outlining an array of racial justice proposals that demonstrated both his leftist politics and how eager he is to improve his performance with black voters from 2016. He was soundly defeated by Hillary Clinton in South Carolina’s primary.