President’s pledge follows criticism from within government that move to create constituent assembly was not democratic.

Nicolas Maduro, president of Venezuela, has pledged to hold a referendum on a new constitution he is proposing in response to two months of violent anti-government protests.

The move on Thursday came after the plan to create a super-body known as a constituent assembly to rewrite the national charter was criticised not just by opponents, but also some within government, as anti-democratic.

Luisa Ortega, the chief state prosecutor, had said creating the assembly without a plebiscite, as happened in 1999 when Maduro’s predecessor Hugo Chavez rewrote the constitution, threatened to “eliminate” democracy in Venezuela.

READ MORE: Why I support Nicolas Maduro

Ortega, the highest-ranking public official to openly defy Maduro in the crisis, has been a traditional ally of the leadership of the ruling Socialist Party, but her criticism of Maduro over the past two months of violent unrest has raised the prospect of divisions in the government camp.

Maduro says the constituent assembly is needed to bring peace to Venezuela, but opponents view it as a cynical tactic to buy time and create a biased body that could perpetuate his party’s rule.

“I shall propose it explicitly: the new constitution will go to a consultative referendum so it is the people who say whether they are in agreement or not with the new, strengthened constitution,” Maduro said on state TV on Thursday.

There was no immediate reaction from Venezuela’s opposition, which now has majority support following a drop in popularity of the Socialist Party amid a deepening economic crisis.

Maduro’s rivals are likely to try to turn any referendum into a vote on the president himself. They have been calling to move forward the next presidential election, scheduled for late 2018.

READ MORE: Why I oppose Nicolas Maduro

The government has said elections for the new assembly will be held in late July, though opposition leaders have said the process is skewed to ensure a pro-Maduro majority.

There was no word on when the plebiscite would be held.

Judge killed amid political unrest

Earlier, authorities announced that gunmen had killed a judge involved in the sentencing of Venezuela’s best-known jailed opposition leader, Leopoldo Lopez, in the latest fatality during weeks of unrest that has left at least 61 people dead.

The judge, 37-year-old Nelson Moncada, was shot and stripped of his belongings as he tried to get away from a street barricade on Wednesday night in Caracas’ El Paraiso district, the scene of regular clashes, the prosecutor’s office said.

READ MORE: New Venezuela clashes after man set ablaze

The government said Moncada was one of the judges who ratified Lopez’s 14-year jail sentence and suggested that might have motivated his killing.

“We cannot exclude the possibility this was done by hitmen hired by right-wing terrorists to keep creating and spreading terror,” Interior Minister Nestor Reverol said, referring to Venezuela’s opposition.

Victims from two months of unrest have included supporters on both sides, bystanders and members of the security forces.

This week has seen widespread violence around the Venezuelan capital, with security forces repeatedly breaking up marches by opposition supporters towards government offices downtown, and skirmishes continuing into the night.

Protesters frequently block roads with rubbish and burning tires, sometimes asking passers-by for contributions towards a self-styled “Resistance” movement against Maduro.

The opposition is demanding elections to remove Maduro from power. They blame him for an economic crisis that has caused shortages of food, medicine and basic supplies.

Maduro accuses protesters of seeking a violent coup and says he is the victim of a US-backed capitalist conspiracy.