In October, prosecutors in the city of Mainz dropped the criminal charges, deciding that Mr. Böhmermann’s satirical poem was merely hyperbole in the name of art and finding no evidence of criminal intent. But that ruling did not affect a separate civil proceeding brought in Hamburg on behalf of Mr. Erdogan, who sought to prohibit circulation of the poem.

A court in Hamburg issued an injunction in May forbidding Mr. Böhmermann from repeating parts of the poem, but the comedian refused to issue a declaration that he would cease and desist, so the case went back to a lower court, which heard arguments and ruled on Friday.

Mr. Böhmermann’s lawyer, Christian Schertz, said in a statement from his office in Berlin that the decision was predictable but that Mr. Böhmermann would file an appeal — to a higher court in Hamburg and then, if necessary, to the Federal Court of Justice. Some of his supporters hope the case will end up before the higher court, in the hopes that the court would set a precedent affirming freedom of speech.

The Hamburg court “again did not sufficiently consider artistic freedom, in particular how the poem was embedded in a whole context,” Mr. Schertz said.

Lawyers for Mr. Erdogan, who sought a complete injunction on the poem and has cracked down on insults at home, previously said they, too, would pursue their case in further court hearings.