Jo Swinson, the Liberal Democrat leader, has won a court order forcing the Scottish National party to withdraw an election leaflet that accuses her of hypocrisy over fracking.

Lord Pentland, a civil judge sitting in the court of session in Edinburgh, ruled the Royal Mail should no longer circulate the leaflet in East Dunbartonshire, the Commons seat Swinson is defending.

Pentland said in a ruling issued after Swinson won an emergency hearing at 4pm on Tuesday that the Lib Dem leader had an arguable case the leaflet was defamatory. He ordered the SNP to pay her legal costs.

The leaflet sent out under the name of Amy Callaghan, the SNP candidate for East Dunbartonshire, claimed Swinson was a hypocrite as she had taken £14,000 from “a fracking company”, Warwick Energy.

Swinson’s lawyers said this was untrue: the donation was from Mark Petterson, a director of the firm acting in a personal capacity, and that the money went to her constituency office.

Roddy Dunlop QC, acting for Swinson, said while Warwick held fracking licences it had not begun drilling, and about 80% of the company’s energy production came from renewable energy sources.

Nicola Sturgeon campaigns with the SNP candidate for East Dunbartonshire, Amy Callaghan. Photograph: Jeff J Mitchell/Getty Images

Pentland said: “The statement which the petitioner claims of is, on the information which has been put before the court this evening, false in substance and materially inaccurate. In my view the petitioner has shown she has a prima facie case that the statement is defamatory.”

Dunlop had argued: “We are in the midst of a general election. It is unlawful for there to be made a false statement of fact in relation to the personal character or conduct of a character. [The] statement that she is a hypocrite is not only inaccurate – it is defamatory at common law.”

Jonathan Mitchell QC, the lawyer for the SNP, said the donation had been recorded in Swinson’s parliamentary register of interests and the hypocrisy accusations in the leaflet did not meet the legal test for defamation.

“The allegation is not one regarding personal conduct or character. It is of her policies,” Mitchell said. “The complaint is about her priorities; her record.”

Following Pentland’s ruling, Mitchell said the SNP would consider appealing as a matter of urgency.