Former Maryland governor Martin O’Malley, who has sought to draw attention to his presidential bid by urging South Carolina to retire the Confederate battle flag, presided over a state for eight years whose official song expresses Confederate sympathies.

Though the controversy over “Maryland, My Maryland” has never remotely approached that surrounding the Confederate flag, there have been several attempts to change the lyrics, including legislation proposed as recently as 2009, during O’Malley’s tenure as governor. O'Malley didn't get involved, according to the legislation's sponsors, and the bill went nowhere.

The song, with lyrics dating to the beginning of the Civil War, contains a plea for Maryland, a border state, to secede from the Union and join the Confederacy. In some verses rarely performed these days, President Abraham Lincoln is referred to as “the despot” and “the tyrant,” while the Union is called “Northern scum.”

The song is set to the tune of “Lauriger Horatius,” better known as the tune of “O Tannenbaum,” and was adopted by the Maryland General Assembly as the state song in 1939. A portion of the song -- without the more controversial lyrics -- is sung each year in Baltimore at the Preakness Stakes, the second leg of horse racing’s Triple Crown.

During the 2009 debate, leaders of the Democratic-led legislature defended the song, saying it reflected the state’s history. Then-Del. Jolene Ivey (D-Prince George’s) summed up the case for changing the lyrics this way: “As a state, we’ve moved forward from glorifying the Confederacy, don’t you think?”

Former senator Jennie M. Forehand (D-Montgomery), the bill’s sponsor, said Monday that she didn’t recall having discussed it with O'Malley. The then-governor, however, was among several state leaders coaxed by a Washington Post reporter that year into singing bits of the song that were posted online. (The singers included some who favored changing the lyrics as well as some who didn’t know them.)

O'Malley's campaign did not comment Monday when asked about the debate over the state song.

He continued to highlight his opposition to flying the Confederate flag on the state capitol grounds in South Carolina, saying in an e-mail to supporters that it is a “rallying banner for hate” and “an affront to so many Americans.” His plea followed last week’s killing of nine African Americans in a Charleston church.

O’Malley’s e-mail, which was sent out shortly before South Carolina Gov. Nikki Haley (R) called for the flag’s removal, said it was “a symbol of 150 years of bigotry and racism -- a reminder of a time our country failed to live up to its founding principles.”

The Confederate flag in South Carolina was hoisted above the capitol dome in 1961, which many in the civil-rights movement saw as a rebuff to desegregation. In 2000, the flag was moved from above the dome to a memorial on the capitol grounds as part of a bipartisan compromise.

O'Malley's e-mail Monday contained links that took readers to a Web page where they could provide contact information for O’Malley’s campaign. He is competing in a Democratic contest that includes Hillary Rodham Clinton, a formidable front-runner, and Sen. Bernie Sanders (I-Vt.), who has generated enthusiasm among the party’s liberal activists.

On Twitter on Monday, Clinton noted she had opposed the Confederate flag “for years.” Sanders said Monday that the Confederate flag should be removed because it had become “a relic of our nation’s stained racial history.”

Here's what the GOP presidential hopefuls have to say about the Confederate flag in South Carolina. (Gillian Brockell/The Washington Post)