(CNN)Two young brothers have been rescued from a remote part of Brazil's Amazon rainforest after being lost for nearly four weeks.
The children -- ages 7 and 9 -- were found near their hometown of Manicoré by a local resident on Thursday, their father told local media. The boys -- who are indigenous Mura people, who live in the central and eastern parts of Amazonas, Brazil -- had been lost for 27 days.
The father said the search was "difficult" and involved police, firemen and Funai, the governmental protection agency for indigenous people. He told local media he had lost hope his sons would be found alive when a local farmer -- who was also a friend of the boys' father -- found the children lying on his property. The older child shouted when he saw someone approaching him, the father said.
Rocineia Lima, a social worker assigned to the case, detailed the boys' fight to survive, and said they worked together to be found.
"The older brother said that (at one point) the younger brother could no longer walk, so he had to go and collect fruit for them to eat. But it came to a point where the older one also could no longer walk," Lima told CNN.
Lima said the farmer was "opening a route in the forest where he has a nut plantation. (He) then heard one of the children crying," she said.
"He (the farmer) was really moved when he found them," Lima added.
The boys were last seen on February 18, when they entered the forest to hunt, CNN Brasil reported. Around 260 people were involved in the search to find them, Lima said.
The brothers were malnourished, dehydrated and with skin injuries, a representative from the State Department of Health of Amazonas told CNN.
The boys survived their time in the forest by drinking rain and river water and eating a wild fruit called sorva. Their skin was covered with insect bites and scratches from tree branches, the health representative said.
The boys were flown to an ICU unit in Manaus -- around 205 miles (330 kilometers) from where they were found -- with their parents on Thursday. During the trip, their condition started to improve, CNN Brasil reported.
Pediatrician Eugenio Tavares told CNN Brasil the boys are in "serious" but "stable" condition, given their experience.
"They are undernourished and have some skin, ear and back infections," Tavares said. "Breathing frequency is normal; they don't have coughs. Kidneys were a concern but they are now functioning very well again. We need to take care of the infections that remain and the careful feeding to know if they will tolerate the progressive diet and gain weight."
On Friday, the children had shown "considerable improvement" from their treatment, according to the health department representative, who added the boys should soon be able to eat solid food.
A team of doctors, including psychologists, nutritionists and physiotherapists are attending to the boys, the representative said.