North Wales Police claimed Owen Jones, 52, of Caernarfon, Gwynedd, was not fit to hold a firearms certificate after officers looked at his profile.
Mr Jones, who had held a licence for more than 30 years, appealed against the decision and won.
Caernarfon Crown Court heard on Friday that he was not a cause for concern despite the posts.
The hearing was told a senior police officer regarded the posts as "highly offensive", prompting the licence to be revoked.
Judge Niclas Parry said Mr Jones was ignorant about the subject of the Muslim faith, but added: "None of those messages were created by the appellant.
"The appellant has liked certain messages that appeared on his Facebook profile. He has then effectively re-published the message."
A man who liked "highly offensive" Facebook messages about Islam had his shotgun licence revoked by police.