Story highlights "We have gone too far as a nation. God knows we have seen so much discrimination in our history," Sanders says

"I had the courage to vote the right way even when it was not necessarily popular," he adds

Washington (CNN) Vermont Sen. Bernie Sanders said Friday that if elected president, he would overturn laws in Mississippi and North Carolina that critics say discriminate against the gay community.

"As president of the United States, I would do everything I can do to overturn those outrageous decisions by Mississippi and North Carolina," he said on ABC's "The View." "We have gone too far as a nation. God knows we have seen so much discrimination in our history."

Governors of Mississippi and North Carolina have recently signed bills into law that gay rights groups and some corporations have decried as discriminatory. Supporters of the bills say they are designed to protect the religious and individual freedoms of the states' citizens.

"What we are trying to do is say, 'You have your political views. That's fine,'" Sanders added. "But I hope we remember what Dr. Martin Luther King Jr. told us. You judge people on their character, not on the color of their skin. And I would add to that not on their gender or sexual orientation."

The presidential candidate said he has supported the LGBT community even when most Americans did not, citing his vote against the 1996 Defense of Marriage Act, a bill that defined marriage as a union between one man and one woman for federal purposes and allowed states to refuse to recognize same-sex marriages acknowledged by other states.

Read More