An ex-convict who posted anti-Islamic rants online pleaded no contest and was sentenced to 30 years in prison on Monday for setting fire to a mosque that the Orlando nightclub shooter attended occasionally.

Joseph Schreiber, dressed in a burnt orange jumpsuit, his wrists and ankles shackled, pleaded no contest during Monday's hearing before Circuit Judge Steven Levin. A no contest plea is treated the same as a guilty plea. Schreiber answered Levin's questions in a clear, unwavering voice before sentencing. He was also ordered to pay $10,000 in restitution although damages exceeded $100,000. Because he was declared a habitual offender, he could have received a life sentence.

He had confessed to detectives that he set fire to the Islamic Center of Fort Pierce last Sept. 11, the 15th anniversary of the 2001 terrorist attacks. The damage to the mosque was so extensive that the leaders recently announced that it will move.

Omar Mateen was killed by police after opening fire at the Pulse nightclub on June 12 in a rampage that left 49 victims dead and 53 wounded, making it the worst mass shooting in modern U.S. history. Mateen professed allegiance to the Islamic State group. His father is among roughly 100 people who regularly attend the mosque.

Schreiber, who is Jewish, posted on Facebook last July that "All Islam is radical" and that all Muslims should be treated as terrorists and criminals.

Prosecutor Steve Gosnell said Schreiber, 32, confessed to detectives that he set the fire, saying he believed Muslims "are trying to infiltrate our government" and that "the teaching of Islam should be completely, completely illegal."

Before he was sentenced, Schreiber read a written statement entitled "From the Mountaintops, Stop the Killings" where he said the fire was not caused by hate but by his anxiety. He feared that Florida could be the site of another 9-11, Boston Marathon bombing or Pulse nightclub shooting, he said.

"My message is this to all the Muslim communities on the face of the Earth — make peace with America and make peace with Israel and stop the killings, stop the attacks," he said.

Schreiber then turned to a man he thought was the mosque's imam and apologized. Mosque member Mohammad Malik whispered "thank you" in return.

"In the Islamic faith and in all faiths, we believe that God is merciful and just as we want to be forgiven by him we should also forgive," Malik said after the hearing. "I believe he was misled. Misled by fear mongering, misled by false information" about Islam. He said the "bright spot" of the fire is that the local Jewish and Islamic communities are now communicating.

Rabbi Bruce Benson, who leads a local Reform synagogue, said he has been meeting with Schreiber regularly since his arrest and believes he is remorseful. Benson said he believes Schreiber subconsciously set the fire just before midnight because no one would be there.

"From the first day I spoke to him, he was thankful no one was hurt," Benson said. "He didn't do this on a Friday afternoon when Mr. Malik and the parishioners were there. He wasn't trying to do this to hurt people. For some reason, he was trying to make a statement."

Schreiber was previously sentenced twice to state prison for theft, according to records from the Florida Department of Corrections. The records show he served his first sentence from March 2008 to July 2009 and his second from June 2010 to August 2014.

Last September, a former inmate who served time with Schreiber at the faith-based Lawtey Correctional Institution, described Schreiber as being a "couple cans short of a six-pack."

Ralph Alfonso said Schreiber joined a Messianic Jewish group he led because he was looking for a place to fit in. Messianic Jews follow Jewish law and the Torah but also believe that Jesus Christ is the Messiah. He said Schreiber sometimes would say something negative about Muslims, but "we would tell him that's not what we believe, that it is not godly."

A surveillance video from the mosque showed Schreiber driving up to the mosque on a motorcycle and approaching the building, possibly talking on a cellphone. Gosnell said Monday that investigators now doubt he was talking on his phone and, if he was, they were never able to determine with whom.

He carried a bottle of liquid and some papers and left when there was a flash. The first 911 calls were made about 45 minutes later, after the fire had spread to the attic. It took about four-and-a-half hours for firefighters to extinguish the blaze.