Washington (CNN) Rep. Alexandria Ocasio-Cortez has apologized to a former Democratic New York state assemblyman who sued her for blocking him on Twitter.

Her apology is part of a settlement regarding a lawsuit filed in July by Dov Hikind. He said Ocasio-Cortez blocked him on Twitter after he criticized her June comments comparing migrant detention camps at the southern border to concentration camps . He claimed she violated his First Amendment right by blocking him on Twitter and cited a July ruling by an appeals court that said President Donald Trump violated the First Amendment by blocking Twitter users.

Ocasio-Cortez, a New York Democrat, said blocking Hikind "was wrong and improper and does not reflect the values that I cherish."

"I have reconsidered my decision to block Dov Hikind from my Twitter account," she said in a statement provided to CNN by her campaign. "Mr. Hikind has a First Amendment right to express his views and should not be blocked for them. In retrospect, it was wrong and improper and does not reflect the values I cherish. I sincerely apologize for blocking Mr. Hikind. Now and in the future, however, I reserve the right to block users who engage in actual harassment or exploit my personal/campaign account, @AOC, for commercial or other improper purposes."

Hikind told CNN on Tuesday that the apology, "which is clear and unequivocal, is wonderful." He also said the settlement sends a message about freedom of speech.

Read More