Boko Haram fighters over the weekend killed at least six farmers who were working on their land near the northeastern Nigerian city of Maiduguri, according to civilian militia members and locals.

The fighters, on motorcycles, attacked the farmers who were preparing their fields for the rainy season outside Amrawa village, 16km from the Borno state capital, on Saturday afternoon.

"The gunmen attacked the farmers with machetes as they were clearing their farms that have been taken over by weed in preparation for the rains which start in few days," said Ibrahim Liman, a civilian militia member.

WATCH: Boko Haram: Behind the Rise of Nigeria's Armed Group

Residents raised the alarm and local militia members pursued the attackers to the nearby village of Sojori, witnesses told AFP news agency."The vigilantes fought the terrorists and killed four while the rest fled," said Liman.

At least 20,000 people have been killed and more than 2.6 million made homeless in northeast Nigeria since the start of Boko Haram's armed campaign in 2009.

Nigeria's government and military maintain that Boko Haram is a spent force, but intermittent attacks and suicide bombings pose a constant threat, particularly in remote areas.

Saturday's attack underscored the vulnerability of rural communities even as the authorities are encouraging displaced people to return home and rebuild their lives.

Northeast Nigeria is in the grip of severe food shortages after farmers missed three rainy seasons in a row because of the conflict.

Crops have been destroyed and food stores looted, while farmers have been either killed or forced to flee to safety in vast camps for the displaced.

Most of the remote region relies on subsistence agriculture, but domestic and international aid agencies are now having to provide food, shelter and healthcare.

The Nigerian authorities mooted a deadline of May 29 to close the camps for the displaced in Maiduguri, though few humanitarian organisations working there believed the date was feasible.

In March last year, Borno's governor, Kashim Shettima, said about 950,000 of the 3.2 million private homes in the state had been destroyed or damaged by years of fighting.

Makeshift camps

Schools, municipal buildings, electricity and water infrastructure and health-care facilities have also been affected.

Those who have returned to their hometowns have found themselves forced into makeshift camps, with water shortages and lack of sanitation increasing the risk of disease.

The insecurity has also affected food distribution, with about 5.1 million people in Borno and the neighbouring states of Yobe and Adamawa said to be "severely food insecure".

READ MORE: The women who love and loved Boko Haram

The Norwegian Refugee Council (NRC) said on Monday that more than one million displaced people or refugees had returned to the region from within Nigeria and outside the country since October.

Cheick Ba, NRC director in Nigeria, said the region was "ill prepared" to cope given the level of destruction, echoing widespread concern from international aid agencies.

In Damasak, in the far north of Borno near the border with Niger, 180,000 people had returned since December but they lacked the resources to resume farming, the agency said.

The UN has said about $1bn is required for Borno, Yobe and Adamawa this year but funding so far is well short of that goal, despite warnings of famine-like conditions in parts of the region.