Nolan West, a GOP legislative aide who is now a candidate for an open House seat, apologized Tuesday for his Facebook posts that lauded the Confederacy and castigated President Abraham Lincoln.

“I apologize for posting insensitive material,” West said in an e-mail. “I’ve taken those posts down because they do not reflect who I am or what I believe.”

On the day South Carolina removed the Confederate battle flag from its statehouse grounds in 2015, West reposted an advertisement for the flags on his Facebook page, continuing his history of publicly expressing admiration for the Confederacy and disdain for Lincoln.

West is currently on House GOP staff while running for the north Metro suburban seat vacated by retiring Rep. Tim Sanders, R-Blaine.

In 2011 West marked the day Confederate President Jefferson Davis resigned from the U.S. Senate, 150 years earlier. West also called Lincoln, a fellow Republican, “the single worst president this country has ever seen.”

Lincoln is credited by historians with holding together the Union, defeating the Confederate insurrection and setting a path for the end of slavery.

This election season candidates have discovered the pitfalls of social media, where offhand jokes, remarks and asides can be used against them by their opponents if they provoke or offend.

DFL candidate Erin Anderson Koegel posted a few foul-mouthed and insulting Twitter posts about Republicans, which the GOP says echo Hillary Clinton’s remarks last week characterizing Donald Trump’s supporters as “deplorables.” Koegel also tweeted #donttrustthepolice while watching the Netflix documentary series, “Making of a Murderer.”

As a teenager on the eve of President Obama’s election in 2008, West posted, “IT’S LYNCHING TIME.” In later years, he posted derogatory comments about women and gays.

West’s post about the Confederate flag in 2015 came at a particularly fragile time in the history of American race relations, just weeks after a shooting by a white supremacist in a historically black Charleston church shocked and outraged the nation. The post quotes a flag retailer assuring prospective customers that all orders would be met despite increased demand.

Another 2015 post seems to belittle efforts to ban the Confederate flag, equating it with the rainbow flag used as a symbol of gay and lesbian identity.

After the shooting at Emanuel African Methodist Episcopal Church in Charleston, which killed nine and injured another, pressure built on South Carolina’s government to remove the flag from statehouse grounds, given its history as the potent symbol of a slave regime.

Minnesota and its Legislature played a key role in the Civil War as the first state to volunteer soldiers — 24,000 out of a total population of just 180,000. The casualty rate of the First Minnesota Regiment at Gettysburg was the highest in the Union Army, according to the Minnesota Historical Society.

West, who began removing potentially offensive posts Tuesday as the Star Tribune was reporting this story, is running against DFL opponent Susan Witt.