PARIS — Marine Le Pen, the French far-right leader, was acquitted on Tuesday in a criminal case involving graphic photographs of acts of violence by the Islamic State that she posted on Twitter in 2015 after comparisons were drawn between the group and her party.Ms. Le Pen, the head of the National Rally party, was acquitted by a court in Nanterre, a western suburb of Paris. The charge against her — the dissemination of violent messages — carried a sentence of up to three years in prison and a fine of 75,000 euros, about $90,000, but prosecutors had only sought a fine of €5,000.Rodolphe Bosselut, Ms. Le Pen’s lawyer in the case, said, “The court judged that by publishing the photos, she was exercising her freedom of expression.” He added that the ruling underlined that the posts clearly were not Islamic State propaganda and had an “informative value” instead.Prosecutors opened their investigation in December 2015, shortly after Ms. Le Pen — furious over a televised interview in which a French journalist compared her party to the Islamic State — posted three pictures on Twitter that showed killings carried out by the group. One showed the body of James Foley, an American journalist who was kidnapped in Syria in 2012 and later beheaded by the group.Ms. Le Pen deleted that post after criticism from Mr. Foley’s family, but the two other pictures, which showed a man in an orange jumpsuit being run over by a tank and a prisoner being burned alive in a cage, remained online.“Daesh is THAT!” she wrote, using an Arabic acronym for the Islamic State, which is also known as ISIS.The pictures — posted just weeks after a string of deadly terrorist attacks in and around Paris — caused outrage in France.Ms. Le Pen lost to President Emmanuel Macron in the 2017 election in France, and her party has a limited presence in Parliament. But she is still seen as Mr. Macron’s main opponent on the national political scene, and the verdict will most likely help her prospects in presidential elections next year, with early polls suggesting that she will again face Mr. Macron in a runoff.The killing of a police officer by a radicalized Tunisian man last month in a town southwest of Paris has fueled a resurgent debate about terrorism, security and immigration, all themes that have fed the rise of Ms. Le Pen’s far-right party, despite Mr. Macron’s attempts to court voters on those issues.Voters on the left and right have often cast aside political difference to oppose far-right candidates, but that dam has also appeared increasingly fragile, and Ms. Le Pen has spent years trying to soften her image and pull her party from the extremist fringe into the mainstream.Unlike other French politicians who have recently been convicted on serious charges like corruption or embezzlement, Ms. Le Pen was prosecuted under a more obscure article in the French penal code that prohibits disseminating messages that are “violent” or that could “seriously harm human dignity” and that could be seen by a minor.While there is robust support for freedom of expression, laws regulating free speech in France are often considered more restrictive than those in the United States, with laws against calls to violence or hate speech.Ms. Le Pen has called the investigation a political witch hunt aimed at silencing her, arguing that she was being wrongly prosecuted for exercising her free speech, on charges normally meant to protect minors from violent propaganda or pornography.“The crime is causing harm to human dignity, not its photographic reproduction,” she said during the trial, held in February.Gilbert Collard, a lawyer and National Rally representative in the European Parliament who had also posted pictures of Islamic State violence on the same day as Ms. Le Pen did, was acquitted of the charges against him on Tuesday, too.The court’s verdict on Ms. Le Pen comes amid an increasingly heated political climate in France, ahead of the presidential elections scheduled for next year but also regional elections this June.