The Government acted unlawfully by seeking to restrict "ethical" boycotts of Israel, the High Court has ruled.

After accepting a judicial review, the judge said Sajid Javid, the Secretary of State for Communities and Local Government, acted unlawfully in issuing guidance to restrict local councils from pursuing boycott, divestment and sanctions (BDS) against Israel through their pension schemes.

The judge said the department's guidance fell outside the proper scope of Mr Javid's statutory powers, because it was issued for non-pensions purposes.

The case, brought by the Palestine Solidarity Campaign (PSC), concerned guidance affecting the Local Government Pension Scheme (LPGS) and how its funds are - and are not - invested.

The guidance was issued by the Department for Communities and Local Government in September last year and is directed at those responsible for preparing LPGS investment strategy.

Trump: Israelis and Palestinians are 'reaching for peace'

The PSC asked the judge, Sir Ross Cranston, to rule that the guidance is legally flawed as one section prevents pension funds set up under the scheme from engaging in boycotts and the "ethical divestment" of companies accused of being complicit in Israel's occupation of Palestine.

Campaigners say the illegal occupation is 50 years old this month and people have a right to decide not to profit from human rights abuses.

Their counsel, Nigel Giffin QC, said it was the Government case that boycotts were contrary to UK foreign policy.

Government lawyers argued that all the grounds of challenge lacked substance.

The judge said that the PSC and their supporters, including War on Want, the Campaign Against Arms Trade and the Quakers, objected to the limiting effect of the guidance on their ability to campaign around the investment of local government pension funds affecting the Palestinian people and the occupied territories.

The Israeli–Palestinian conflict intensifies Show all 10 1 /10 The Israeli–Palestinian conflict intensifies The Israeli–Palestinian conflict intensifies Medics evacuate a wounded man from the scene of an attack in Jerusalem. A Palestinian rammed a vehicle into a bus stop then got out and started stabbing people before he was shot dead AP The Israeli–Palestinian conflict intensifies Israeli ZAKA emergency response members carry the body of an Israeli at the scene of a shooting attack in Jerusalem. A pair of Palestinian men boarded a bus in Jerusalem and began shooting and stabbing passengers, while another assailant rammed a car into a bus station before stabbing bystanders, in near-simultaneous attacks that escalated a month long wave of violence AP The Israeli–Palestinian conflict intensifies Youths attend the funeral of Ahmad Sharake who was shot during clashes with Israeli forces in Jelazun refugee camp, near Ramallah, West Bank. Tensions in the area continue to run high following a series of stabbing attacks that have occurred around Israel in clashes between Palestinian youths and Israeli security forces Getty Images The Israeli–Palestinian conflict intensifies Palestinians throw molotov cocktail during clashes with Israeli troops near Ramallah, West Bank. Recent days have seen a series of stabbing attacks in Israel and the West Bank that have wounded several Israelis AP The Israeli–Palestinian conflict intensifies Women cry during the funeral of Palestinian teenager Ahmad Sharaka, 13, who was shot dead by Israeli forces during clashes at a checkpoint near Ramallah, at the family house in the Palestinian West Bank refugee camp of Jalazoun, Ramallah AP The Israeli–Palestinian conflict intensifies A wounded Palestinian boy and his father hold hands at a hospital after their house was brought down by an Israeli air strike in Gaza Reuters The Israeli–Palestinian conflict intensifies Palestinians look on after a protester is shot by Israelis soldiers during clashes at the Howara checkpoint near the West Bank city of Nablus EPA The Israeli–Palestinian conflict intensifies A lawyer wearing his official robes kicks a tear gas canister back toward Israeli soldiers during a demonstration by scores of Palestinian lawyers called for by the Palestinian Bar Association in solidarity with protesters at the Al-Aqsa mosque compound in Jerusalem's Old City, near Ramallah, West Bank AP The Israeli–Palestinian conflict intensifies Undercover Israeli soldiers detain a Palestinian in Ramallah Reuters The Israeli–Palestinian conflict intensifies Palestinian youth burn tyres during clashes with Israeli soldiers close to the Jewish settlement of Bet El, in the West Bank city of Ramallah, after Israel barred Palestinians from Jerusalem's Old City as tensions mounted following attacks that killed two Israelis and wounded a child

He said: "On the other hand, the Government is concerned that local government pension funds should not be involved in such political issues because of the mixed messages it might give abroad; because it might undermine community cohesion at home by legitimising anti-Semitic or racist attitudes and attacks - although it accepts that anti-Israel and pro-Palestinian campaigning is not in itself anti-Semitic; and because it could impact adversely on the financial success of UK defence industries.

"None of these matters are at issue in this judicial review.

"The conclusion reached in the judgement has nothing to do with the political merits of the claimants' or the Secretary of State's position on these matters.

"In this court, the challenges the claimants raise are soluble through legal analysis, not political argument.

"The political merits of the respective arguments have no relevance."

Hugh Lanning, chair of the PSC, said: "Today is a victory for Palestine, for local democracy, and for the rule of law.

"Absolutely everyone has a right to peacefully protest Israel's violation of Palestinian human rights.

"This ruling upholds the right of local councils and their pension funds to invest ethically without political interference from the government of the day.

Ben Jamal, director of PSC, said: "Our recent YouGov polling shows 43 per cent of the public think BDS [boycott, divestment and sanctions] is reasonable.

"We couldn't be happier that this right has been upheld by the court in the month the illegal occupation of Palestine turns 50 years old.

"PSC will take forward its campaign for justice for the Palestinian people with renewed vigour."