PORTLAND — Maine Gov. Paul LePage says U.S. Rep. John Lewis needs a history lesson and should be grateful for all that presidents have done for black people.

The Republican governor on Tuesday addressed Lewis’ criticism that GOP President-elect Donald Trump is not a “legitimate president.” LePage said on WVOM-FM that the black Democratic Georgia congressman needs a lesson on how presidents freed the slaves and fought against Jim Crow laws.

Lewis was one of the leaders of the Civil Rights Movement. He suffered a fractured skull while leading the march in Selma, Alabama.

“John Lewis ought to look at history,” LePage said. “It was Abraham Lincoln who freed the slaves. It was Rutherford B. Hayes and Ulysses S. Grant who fought the Jim Crow laws. A simple thank you would suffice.”

But Hayes’ election actually kicked off Jim Crow laws. The governor’s interpretation ignores that and leaves out almost 100 years of history.

Jim Crow laws, which enforced racial segregation in the South, were in place from the late 1870s to the 1960s. Grant’s signing of the Civil Rights Act of 1875 was largely ignored in the former Confederacy.

Then, Hayes won office under the Compromise of 1877, an informal deal after a contested election that gave him the White House in exchange for promising to pull Northern troops out of the South. It allowed Jim Crow laws to take root. That’s why Lewis and others marched in Alabama in 1965, where he was beaten by state troopers.

LePage also had harsh words for a Maine congresswoman who, like Lewis, is skipping the inauguration. He says Democratic Rep. Chellie Pingree should resign if she doesn’t attend.

The Associated Press contributed to this report.