But Hun Sen, an authoritarian leader in power since 1985, vowed not to allow Rainsy to return, saying he would be arrested on sight, and has sought support from regional neighbours to thwart the opposition's plans.
The Phnom Penh Municipal Court said in a statement released on Sunday that Mr Sokha could leave his house, but that he could not engage in political activity or leave the country.
When asked whether Thursday's events, which included Sam Rainsy being prevented from boarding a Thai Airways flight to Bangkok as a result of what the CNRP chief said was Hun Sen's interference, and Thai Prime Minister Prayuth Chan-o-Cha announcing that he could not enter Cambodia from Thailand, Mu Sochua acknowledged that the CNRP might repatriate via a different country.
The EU accounts for more than one-third of Cambodia's exports, including garments, footwear and bicycles.
"Malaysia deserves kudos from around the world", said Phil Robertson of US -based Human Rights Watch.
Hun Sen has made clear that he would have Sam Rainsy arrested upon entering the country. But if you look at the reality, it's just on bail.
Government spokesman Phay Siphan reported that when Sam Rainsy did return he'd confront outstanding charges against him. "This action relates to the court".
"Kem Sokha's release from house detention is a last minute attempt to deflect European anger at the shoddy way PM Hun Sen and Cambodia have dealt with human rights concerns raised in the EBA process", said Phil Robertson, deputy director for Asia of Human Rights Watch.
Hun Sen, whose government has arrested some 50 opposition activists inside Cambodia in recent weeks, earlier characterised the bid by Sam Rainsy and several colleagues to return and hold rallies as an attempted coup.
"On behalf of the Cambodia National Rescue Party, I urge... the worldwide community to increase pressure", he said.
"This is a first step and we continue to call for the dropping of all charges against him and the reinstatement of his political rights".
In a post on Facebook following his release, Kem Sokha expressed disappointment with the investigating judge's rejection of a request from his lawyers to drop the charges against him.
Hun Sen, known over nearly 35 years in power as a wily and ruthless politician, has a history of employing divide-and-rule tactics against his opponents.
"We call on authorities to protect and respect the human rights of all people in Cambodia and to take meaningful steps to reopen political and civic space", the statement said, adding that members of the Association of Southeast Asian Nations (ASEAN) should comply with obligations under global law to respect the principle of non-refoulement where individuals may be at risk of persecution or torture if returned. Cambodia's long holiday weekend runs through Tuesday.
Sam Rainsy fled to Paris in 2015 after a conviction for criminal defamation and faces a five-year sentence in a separate case - charges he says were politically motivated. We are on the right track, ' Rainsy said on arrival at Kuala Lumpur International Airport in a message to supporters. Hun Sen has said that arrest warrants for Rainsy were sent to neighbouring countries, and troops deployed at the Thai-Khmer border to stop him from travelling home by land.
The decision comes as Sokha's political partner Sam Rainsy is waylaid in Malaysia with other CNRP officials after attempting a highly-publicized comeback on November 9, Cambodia's independence day.