Violence breaks out hours after a peace truce was struck between President Daniel Ortega and protesters.

A shooting and fire in Nicaragua has left eight people dead and shattered a truce struck hours earlier between President Daniel Ortega and protesters after two months of political unrest that has caused at least 170 deaths.

Loud bursts of assault rifles were heard on Saturday morning, apparently emanating from makeshift roadblocks near a university campus, according to a Reuters news agency reporter in Managua, Nicaragua's capital and the epicenter of protests since mid-April.

The violence flared hours after Ortega and civic leaders agreed on Friday to cease hostilities, remove roadblocks and allow for a foreign inquiry into the country's bloodiest confrontations since a civil war ended in 1990.

Despite the breakout of violence, both sides resumed talks to address the Catholic Church's proposal to anticipate general elections and implement political reforms.

Local media reported that police and pro-Ortega masked gunmen had fired at protesters guarding the roadblocks. The government did not reply to a request for comment on the reports.

The national police in a statement attributed the gunfire to protesters, and said two men had died. A police spokesman reached by phone declined to comment.

Investigators from the Inter-American Commission on Human Rights and Amnesty International have condemned the government crackdown and documented excessive use of force by police and government forces.

Amid the morning's unrest, a building near the university caught fire, killing six people including two children, the police said in a statement. Local television showed images of firemen carrying two toddlers from the burning building.

Firefighters battling the blaze came under attack from masked "delinquents", the statement said. Police said they would investigate the cause of the fire.

Jose Maria Hernandez, 63, uncle of the building's owner, said his nephew and nephew's wife died in the blaze that had resulted from a confrontation with police.

"This is a massacre. A barbarity. These police surrounded the house and burned it after my nephew refused to let them put snipers on the roof," Hernandez told Reuters outside the building, which had spewed thick black clouds of smoke.

Ortega's surprise decision in April to slash pension benefits to cover a widening social security gap triggered the demonstrations that quickly turned fatal and led to demands for his resignation.

The Nicaraguan Center for Human Rights, which has monitored the violence, said at least 170 people were killed in the eight weeks of clashes between pro-Ortega forces armed with assault rifles and pistols and protesters armed with rocks, slings and homemade mortars.

Ortega has accused protesters of trying to undermine democracy in one of the Western Hemisphere's poorest countries. Violence has ground the economy to a halt.

Juan Sebastian Chamorro, a civic leader who agreed with Ortega to halt hostilities, told Reuters civil society leaders would soon make a pronouncement about the flare-up of violence.