A US man who set fire to a prayer rug in an Ohio mosque was sentenced to 20 years in prison after pleading guilty to hate crime charges, officials said Tuesday.

"Hate crimes like this seek to damage more than buildings, they take aim at our American way of life," Steven Dettelbach, US Attorney for the northern district of Ohio, said in a statement.

"But today's 20-year prison sentence and the coming together of this community to support our Muslim neighbors show that our freedoms are stronger and more resilient than this man's hatred."

Randolph Linn, 52, admitted to leaving his home in Indiana and driving to the Islamic Center of Greater Toledo with the intent to damage a Muslim house of worship on September 30.

He loaded his red Chevy Sonic up with "numerous firearms and three red gas cans" and tried several times to get into the center before he finally managed to break in, prosecutors said.

Linn admitted to walking through several rooms with a handgun in his left hand before stepping back outside to grab a red gas can. He then poured the gasoline over a large rug in the prayer room and set fire to it.

As part of the plea deal, Linn agreed to pay for the water and fire damage to the center, which could exceed $1 million.

Prayer services resumed at the center on March 15 even though the restoration is not yet complete, the Islamic Center said in a notice on its website.