NAYPYIDAW, Sep 8 (Reuters) - Southeast Asian and Western countries have urged all sides in Myanmar to refrain from violence and allow in humanitarian aid, after a shadow government, formed by opponents of military rule, declared a nationwide uprising against the junta.

The National Unity Government (NUG) said on Tuesday (Sep 7) it was launching a "people's defensive war", signalling what appeared to be a bid to coordinate groups fighting the military as well as calls for troops and officials to switch sides.

A military spokesman dismissed the call for revolt as a ploy to gain world attention and said it would not succeed.

There were no immediate reports of violence on Wednesday, though security forces were out in strength in Myanmar's biggest city, Yangon. A day earlier, there were protests and a flare-up in fighting between the army and ethnic minority insurgents.

"All parties must prioritize the safety and well-being of the Myanmar people," Indonesian foreign ministry spokesman Teuku Faizasyah told Reuters, noting humanitarian assistance could only be distributed if the situation on the ground was secure.

Indonesia has taken the lead among Myanmar's neighbours in trying to resolve a crisis triggered when the military toppled the elected government of Aung San Suu Kyi on Feb 1.

The security forces have killed hundreds of protesting democracy supporters and some opponents of military rule have formed armed groups under the banner of People's Defence Forces.

They have also forged alliances with ethnic minority groups fighting for self-determination who have long seen Myanmar's army as their enemy.

But it remains to be seen to what extent the NUG can influence the course of events.

"The NUG declaration has received strong support on Myanmar social media," said Richard Horsey, a Myanmar expert at the International Crisis Group.

But he said it was not clear if opposition forces had the capacity to escalate the fight against Myanmar's well-equipped military and the NUG's declaration of "war" might backfire by making it harder for some countries to support it.