The reversal in their positions, after weeks of saying the migrants were not welcome, came as more than 430 weak, hungry people were rescued by a flotilla of Indonesian fishermen who brought them ashore in the eastern province of Aceh.
Nearly 3,000 Bangladeshi and Rohingya Muslim migrants have come to shore in recent weeks, but many were turned away.
Malaysia’s foreign minister Anifah Aman announced the change after emergency talks in Kuala Lumpur with his Indonesian and Thai counterparts on the growing humanitarian crisis.
One of the fishermen who led the rescue effort said he wept when he spotted the migrants’ green wooden trawler and saw the people on board screaming for help. “As we came close, I was shocked. I saw them crammed on to the boat. It left me speechless and I broke down in tears as I watched them screaming, waving their hands and clothes,” said 40-year-old Razali Puteh.
Malaysia is the current chair of the ten-nation group of south-east Asian nations known as Asean.
“This is not an Asean problem,” Mr Aman said after the meeting. “This is a problem for the international community. We are talking about a humanitarian crisis.”
Part of the crisis stemmed from the stance of Asean nations, which until now was to turn away boats and not allow migrants to reach their shores, fearing allowing a few in would lead to an unstoppable flow.
Thailand had said it cannot afford to take any more migrants since it is already overburdened by tens of thousands of refugees from Burma, but agreed at the meeting to provide humanitarian assistance, Mr Aman said.
Malaysia and Indonesia “agreed to offer temporary shelter provided that the settlement and repatriation process will be done in one year by the international community”, according to a joint statement.
Asked about the conditional wording, Mr Aman said the two countries would not wait for international support but would start giving migrants shelter “immediately”. “It has to be immediate because we can’t leave those people out at sea,” Mr Aman said at a news conference in Putrajaya, Malaysia.
The United Nations refugee agency believes there are some 4,000 still at sea, although some activists estimate up to 6,000.
Aid agencies praised yesterday’s breakthrough. Joe Lowry, for the International Organisation for Migration, said: “It’s extremely good news coming out of Malaysia. The problem is that, so far there is no agreement on search and rescue and these boats have got to be found.
“There’s a huge body of water and only a small number of boats, and the more time that goes on the more desperate their conditions are going to become.”