Malaysia said Thursday it would work with Myanmar to repatriate thousands of their nationals following clashes in the community that left at least four dead and led to a security sweep.

The two Southeast Asian nations insisted that violence -- beginning late May at a wholesale market in Kuala Lumpur -- linked to strife between majority Buddhists and minority Muslims in Myanmar was under control.

Malaysian authorities have suggested Buddhists came under attack from Muslim countrymen seeking vengeance over deadly sectarian strife back in Myanmar.

"It is a clash of Myanmars among themselves... The quarrel they have back home is brought to our country," Malaysian Deputy Home Minister Wan Junaidi Jaafar told reporters after meeting a delegation from Myanmar.

He said some 257,000 Myanmar nationals work in Muslim-majority Malaysia -- 144,000 of these illegally -- filling mostly lowly paid jobs in plantation, construction and other sectors shunned by locals.

Some 250 people remain in detention here after a security sweep last week following the deadly clashes, in addition to illegals held previously.

"We have 4,400 Myanmar detained in immigration detention centres now, and we have invited the Myanmar authorities, especially the embassy, to... bring them back," Wan Junaidi said.

He also called on the United Nations refugee agency to swiftly process those who say they are refugees and feel unsafe to return to Myanmar.

The agency has documented some 95,000 Myanmar refugees in Malaysia, which does not grant them any legal status but allows temporary stays.

Of them, 28,000 are Muslim-ethnic Rohingyas, who are denied citizenship in Myanmar. The United Nations has described them as one of the world's most persecuted minorities.

Deadly sectarian strife pitting Buddhists against the Rohingyas has continued since last year in Myanmar's western state of Rakhine.

Myanmar Deputy Foreign Minister Zin Yaw said in separate comments to reporters that the attacks in Malaysia were believed to be "gang-related" and not necessarily religious.

"We ask help from the Malaysian government to protect our people working here. Some want to go back to Myanmar so (we will) make arrangements for them to go back quickly," he said.