Myanmar President Thein Sein has said that his government will use force if necessary to quell deadly religious rioting that started last week, as attacks on Muslims by Buddhist mobs continued in several towns.

In his first public comments on the violence, Thein Sein warned in a televised speech on Thursday that he would make all legal efforts to stop "political opportunists and religious extremists" trying to sow hatred between faiths.

The recent religious unrest began on March 20 with rioting by Buddhists targeting minority Muslims in the central city of Meikhtila that left at least 40 people dead and forced about 12,000 to flee from their homes.

The unrest spread this week to several towns in the Bago region, about 160km north of the country's biggest city, Yangon.

Curfews and bans on public gatherings have been imposed in the affected areas, but state television reported that groups of people attacked houses, shops and religious buildings, including mosques, on Thursday in two towns in Bago.

On Wednesday, it reported that security forces fired shots into the air to break up attacks, which residents said targeted Muslim properties.

"In general, I do not endorse the use of force to solve problems. However, I will not hesitate to use force as a last resort to protect the lives and safeguard the property of the general public," said Thein Sein, who took office in 2011 as part of an elected civilian government after almost five decades of repressive military rule.

By instituting democratic changes and economic liberalisation, he has built a reputation as a reformer and restored relations with Western nations that had shunned the previous military regime for its poor human rights record.

'Democratic transition'

"We must expect these conflicts and difficulties to arise during our period of democratic transition,'' he said in a 10-minute speech.

"As we rebuild our society, we must rise above 60 years of historical bitterness, confrontational approaches and a zero-sum attitude in solving our differences.''

But tensions have heightened since last year when hundreds of people were killed and more than 100,000 made homeless in violence in western Myanmar between ethnic Rakhine Buddhists and Muslim Rohingya.

Thein Sein called on police to "perform their duties decisively, bravely" and according to the law. He said the military, called out after two days to restore order, also played "a meaningful role in safeguarding property and the rehabilitation of victims."

Police in Meikhtila had been criticised for failing to act quickly and decisively against the rioting, in which mostly Muslim-owned houses, shops and mosques were burned down.

The violence in Meikhtila was sparked by a dispute between a Muslim gold shop owner and his Buddhist customers, and escalated after reports spread of a Buddhist monk being killed by a Muslim mob.

Thein Sein said he was "deeply saddened to find out that a simple private dispute led to a deadly riot and that some unruly instigators, taking advantage of the disingenuousness of the public, tried to spread the riots to other parts of the country."