For the waste pickers that have traditionally made a living sifting through the mountain of discarded litter that blights the streets of Cairo, there has been scant cause for celebration these past 10 years. Marginalised by a 2004 Mubarak goverment directive that placed household waste collection in the hands of multinationals, their existence has been one of ever increasing struggle for steadily declining return.

But change is afoot. Government acceptance that the corporatisation of waste disposal in Egypt's capital has been a resounding failure has paved the way for the formal integration of the zabaleen – who, for more than half a century, went door to door gathering the vast majority of household waste in Cairo – into the city's official refuse collection system.

For a community that has served Cairo well, the government's U-turn offers a deserved chance to change their lives for the better. Before 2004, the zabaleen would take the rubbish they collected back to their homes on the edge of the city, sort through it, and make a living from selling the salvaged materials to factories and wholesalers. The remaining organic waste would be fed to their pigs, whose meat also brought them a steady income.

But 10 years ago, this informal arrangement came to an abrupt end when the Mubarak government contracted four corporate firms to do the work instead – cutting the 65,000 zabaleen out of the process, and wrecking their collective livelihood. The aim was to professionalise the capital's waste management.

Government officials now admit that approach was flawed from the start, and for the first time are starting to make the zabaleen's role official, giving them uniforms and vehicles.

"The others have failed, be they the government or the foreign companies, and now [the zabaleen] should get a turn, having been sidelined for so long," said Laila Iskandar, Egypt's environment minister, who has prioritised the issue since her appointment in July. "They are the people who have the longest experience in refuse collection."

Before 2004, Cairo residents paid the zabaleen a monthly fee to collect waste. Under the formalised system, the four firms simply left large bins in the street, asked residents to deposit their waste in them, and made them pay for this supposed privilege through their electricity bills. "Of course, this was very stupid," said Suzie Greiss, head of Egypt's Association for the Protection of the Environment (Ape). "When you have very big high-rise buildings, people are still going to want collection."

The zabaleen ended up collecting much of the rubbish directly from the flats anyway, but for a quarter of the money they previously earned. Many residents felt they were paying the multinationals enough; as a result, they did not want to pay the zabaleen as much as they had done previously, even though they did most of the work. To add insult to injury, the firms subcontracted a community of middle-men – the wahaya – to deal with some of the waste. But according to Greiss, the wahaya pocketed the money and left almost all the collection to the zabaleen. "It was a very unfair relationship," she says.

Compressed cartons are sifted from rubbish in the sprawling Cairo neighbourhood of Mokattam, the hub of the waste business. Photograph: Khalil Hamra/AP

The effect on the zabaleen, Iskandar says, was devastating. Eissa Habil Aramanyos, a 35-year-old zabal, reckons the move cost him 75% of his earnings. Before the change, he might have earned five Egyptian pounds (43p) from each flat. Afterwards, he got one or two if he was lucky; to make up the shortfall, he had to work longer hours over a much larger area.

"Before I used to work from 5am to 4pm, and I took home good money," said Aramanyos, who lives in Manshiyet Nasr, a cramped settlement of 20,000 zabaleen in eastern Cairo. "Afterwards, I worked from 4am to 9pm. So we had to do more work, we were constantly tired and we earned less."

Community leaders tried to persuade officials to use the zabaleen formally within the system, but they received a patronising response, said Ezzat Naem Guindy, head of the zabaleen workers' syndicate, and chairman of Spirit of Youth, an influential local NGO. "Every time we tried to convince the government that the zabaleen worked hard and collected from the flats directly, the government said: 'How can we contract them? They're not formed into companies. They don't pay taxes.'"

With resources stretched, children ended up sharing more of the burden, Aramanyos said. Due to their nebulous legal status, some zabaleen were even arrested for flouting the new regulations, according to Naem Guindy. But despite it all, he says, the zabaleen still deal with 9,000 of Cairo's 15,000 daily tons of household rubbish, recycling 85% of it.

The zabaleen were dealt another broadside in 2009. A Christian community, they were among the few people to keep pigs in a mainly Muslim country. They fed Cairo's organic waste to the animals, whose meat provided a good secondary source of income. But that changed when the Mubarak government culled more than 300,000 pigs, and closed Egypt's two pork slaughterhouses. Officials said the idea was to contain swine flu, despite international advice that it was unnecessary; many zabaleen regarded the move as a sectarian slight.

Once again, earnings – and, in some cases, health – were affected. "We were having a hard time treating children for anaemia, because pigs had been a very good and cheap source of protein."

Groups such as Spirit of Youth have spent years encouraging zabaleen to start formal companies, so when Iskandar was appointed environment minister, some of them were in a position to be incorporated properly into the system. This month, 14 zabaleen companies began working a pilot scheme in Dokki, a suburb in west Cairo; 48 will begin work elsewhere in the west in the coming months. They have been given uniforms and government vehicles, training from Spirit of Youth, and are paid 12 Egyptian pounds per flat.

"It's a pleasure to be part of the new system," said Aramanyos, who runs one of the companies yet to be deployed. "I make more money, and now I'm legal. I'm a company. I have paperwork. Before we weren't formally involved in the process – but now we can meet the officials in charge for districts, so if we have a problem, we have people to talk to."

Some resistance remains, not just from the wahaya, who have stalled the transition in east Cairo, but from some zabaleen frightened of abandoning the current system. It may be exploitative, but at least they understand how to navigate its pitfalls.

Iskandar argues the zabaleen may never have a better opportunity to formalise their business. "They need to understand that this is their last chance to integrate into the system," she said. "They now have a syndicate, NGOs and a disgruntled public on their side – so it's up to them to take this chance and make it work."