The High Court has ruled that the Government acted unlawfully in seeking to restrict "ethical" boycotts on Israel.
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.
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.
Allowing the application for judicial review on Thursday, the judge said that the Secretary of State for Communities and Local Government acted unlawfully in issuing this part of the guidance as it fell outside the proper scope of his statutory powers because it was issued for non-pensions purposes.
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.
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 judgment 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% 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."
Jamie Potter, partner in the Public Law and Human Rights team at Bindmans LLP, said: "This outcome is a reminder to the Government that it cannot improperly interfere in the exercise of freedom of conscience and protest in order to pursue its own agenda."