A New Jersey man who used his Islamic organization’s Web site to advocate violence against those whose ideals he found offensive to his religion was sentenced Friday to 21/2 years in prison — a term that a federal judge said he imposed so people would “understand the line” between free speech and criminal calls for violence.

Yousef al-Khattab, 45, renounced his postings during the hearing in federal court in Alexandria, asking U.S. District Judge Liam O’Grady to hold him responsible only “for what I say, not how other people understood it.”

Derisively calling himself a “clown” and “the Gilbert Gott­fried of the Muslims,” Khattab said he did not intend to incite violence but would not make the postings today that he did years ago.

“I look back now, and I’m very wrong,” Khattab said.

For his part, O’Grady said that he believed Khattab would not make the postings again but was skeptical that his intention had been only to spark discussion. O’Grady asked Khattab particularly about a post he made seeming to direct followers to attack the Chabad Jewish organization’s headquarters in Brooklyn.

Court records show that in 2009, Khattab posted a photo of the headquarters with a link to a map and noted that the main temple was always full at prayer times. In another post that year, he told readers to seek out leaders of Jewish organizations in the United States and “deal with them directly at their homes,” court records show.

“To a reasonable person, you were espousing violence, encouraging violence, praising violence in very plain language,” O’Grady said. “What you did is criminal.”

Prosecutors also argued that authorities had connected more than 12 followers of Khattab and the organization he helped found — Revolution Muslim — to various terrorist plots or organizations.

Among them were Colleen LaRose, the American woman who used the nickname JihadJane as she allegedly recruited people to “wage violent jihad,” and Samir Khan, who is said to have founded the notorious al-Qaeda magazine Inspire. He was killed in a controversial drone strike alongside American Anwar al-Awlaki, an al-Qaeda operative.

“Mr. Khattab’s aim was to inspire Muslims to engage in terrorism,” Assistant U.S. Attorney Gordon D. Kromberg said in court. “He succeeded.”

Defense attorney Alan H. Yamamoto argued that his client’s postings were no different than those of several anti-Muslim groups and Khattab thought that what he was doing was legally protected as free speech. He acknowledged that Khattab “stepped over the line” but disputed the notion that he was “the reason all these nuts are out there doing things.”

Khattab renounced some terrorist attacks, including the Boston Marathon bombing, and referred to some of his former affiliates as “scum.”

“To hold him responsible for all the hate and anger that’s out there is just not correct,” Yamamoto said. “He was a block in that wall, but he’s not the wall.”

Prosecutors had asked that Khattab spend three years in prison; Yamamoto sought a year and a day for his client.

O’Grady said he agreed that Khattab’s actions warranted a lesser punishment than those in similar cases. Revolution Muslim co-founder Jesse C. Morton, for example, was sentenced in 2012 to 111 /2 years in prison after admitting that he encouraged extremists to attack the writers of the “South Park” animated TV show because an episode featured the prophet Muhammad in a bear suit.

But O’Grady also said that “freedom of speech carries with it responsibility” and that the postings of Khattab were “horrific.”

Khattab, who was allowed to report on his own to jail at a later date, told O’Grady after the sentence was imposed: “I have no hard feelings, and I thank you.” He declined to comment after the hearing.