Israel’s parliament has passed a law that could ban groups critical of the armed forces or the state from entering schools and speaking to students.

Early on Tuesday, legislators passed the law by 43 votes to 24 in a move that its detractors say will stamp out free speech in the educational system.

As an amendment to the country’s education act, the law grants extensive powers to Education Minister Naftali Bennett, the education minister and head of the religious-nationalist Jewish Home party.

He can decide to ban groups, the bill states, if they “actively promote legal or international political actions to be taken outside Israel against soldiers of the Israel Defence Forces ... or against the state of Israel”.

“Anyone who wanders around the world attacking IDF soldiers will not enter a school,” Bennett said in a statement.

However, critics warn the law is so vague that it could apply to any person or body that criticises Israel to a foreign entity or government – for example, an Israeli rights group that submits an unfavourable report to a UN agency.

The legislation has been dubbed the “Breaking the Silence” bill, a reference to an anti-occupation Israeli human rights group run by military veterans that collects and publishes testimony on army abuses.

Bennett has been deeply scathing of the organisation, accusing it of damaging Israel’s image abroad and putting soldiers and officials at risk of prosecution for alleged war crimes.

Yehuda Shaul, one of the founders of Breaking the Silence, said the law was “the broadest restriction on freedom of expression for political reasons ever put into Israeli law”.

He said its goal was to silence criticism of the Israeli occupation of the Palestinian territories and Jewish settlements in the West Bank. “This is a turning point where Israeli society stops being an open society,” he said.

Amir Fuchs, the head of the defending democratic values programme at the Israel Democracy Institute, said the law gives the minister the authority to block NGOs if they contradict a long list of vague “educational goals”. He warned that future administrations might use it to stifle religious or rightwing groups.

“A variety of opinions should be heard in schools to expose and open children up to different views,” he said.

The bill is one of two debated this week in the Israeli parliament, the Knesset, that have been criticised as draconian and anti-democratic.

Prime Minister Benjamin Netanyahu, the prime minister, had hoped to pass another draft law that caused an uproar due to a line in the text that appeared to legalise racially segregated communities, which could allow for Jewish-only towns.

It has since been reported that the Nation-State bill, which has not passed but would hold constitution-like status and has been compared to apartheid, has been amended to read that the state will instead “encourage and promote” Jewish settlements.

Israel’s government and its parliamentary allies have waged a fierce campaign against domestic and international NGOs that criticise its policies.

The Ministry of Strategic Affairs and Public Diplomacy has targeted NGOs that work in the occupied Palestinian territories and humanitarian groups. In May, it published a report accusing the EU of providing millions to NGOs that it claimed had “ties to terror and boycotts against Israel”.

The EU’s foreign affairs chief, Federica Mogherini, replied with a terse letter this month to its minister, Gilad Erdan, saying the allegations were “unfounded and unacceptable”.

A copy of the letter, seen by the Guardian and dated 5 July, said EU funding is not used to support activities linked to boycotts against Israel and “certainly not to finance terrorism”. To conflate the boycott issue with terrorism, she wrote, creates an “unacceptable confusion in the public eye”.

She added: “Vague and unsubstantiated accusations serve only to contribute to disinformation campaigns.”