The five were in healthy condition after authorities secured their release at the Ban Din Samor border checkpoint in Than To district of Yala, said Pramote Promin, a spokesman for Region 4 of the Internal Security Operations Command (Isoc).
"We thanked the Malaysian soldiers for taking care of them while they were held in custody," said Col Pramote.
The five men are Supoj Rodduang, 40; Naret Supasit, 48; Somchai Kraidam, 48; Pongsathorn Onthai, 41; and Noppadol Pankaew, 15. They have returned home and have not been charged by Malaysia.
They had left their homes in Than To on Thursday to forage for food in the forest along the Thai-Malaysian border and lost their way before being arrested on Friday.
Malaysian soldiers stationed at the border crossing at Ban Din Samor alerted Thai troops about the men they had in custody. The malaysians seized two rifles and 12 bullets found in the men's possession.
Lt Gen Walit Rojanapakdi, commander of Army Region 4, assigned Maj Gen Ruangsak Suwannakha, chief of the 5th Infantry Division, to contact Malaysian soldiers in seeking the men's release.
Col Pramote said the Thais had no intention to enter Malaysia territory and had simply lost the trail on the border mountain.
They were carrying weapons for self-defence and to hunt wild animals, he added.