BANGALORE, India — The sun was climbing in the morning sky as a man in his late 50s stripped to his underwear and prepared to lower himself into a pit of sewage.

Kaverappa looked down into the shaft behind a house on the southern rim of India’s technology capital. Then he hooked his fingers and toes into grooves in the concrete pit, 10 feet deep, and began to descend.

A foul, sulfurous smell floated up. Soon his legs, arms, chest and shoulders were coated with near-black fluid, the product of a year’s worth of toilet waste.

Such work — emptying septic tanks and sewers by hand — is both dangerous and illegal in India. But for Kaverappa, who goes by only one name, it is an ordinary day. He wants to leave the job behind but feels there is no alternative. “We don’t have anything else,” he said.

Indian Prime Minister Narendra Modi has received international plaudits for his campaign to build millions of toilets across the country. But the cleanliness drive has failed to eliminate the country’s most stigmatized and hazardous sanitation work: dealing with human waste by hand.

Even in Bangalore, an expanding metropolis that is home to software giants and multinational firms, deaths of sewer workers occur with depressing regularity. At least three people have died cleaning sewers in Bangalore since March; across India, activists have documented 112 such deaths this year, more than one every three days.

Despite a 2013 law forbidding the practice, cleaning sewers and removing blockages is still done by hand and without any safety equipment in many parts of the country. Employers who violate the law are not punished.

Modi’s cleanliness drive has scored key victories: The number of people with access to toilets has increased dramatically since 2014. But the race to celebrate progress has obscured crucial gaps. For instance, a survey carried out by India’s national statistical body revealed that a quarter of rural Indians still do not have access to toilets, contrary to the government’s claims.

What’s more, the toilet-building drive is creating its own challenges, experts say. Many of the toilets built in the campaign are in rural areas with no sewage systems. A large percentage of the toilets are connected to basic holding pits that do not convert waste into fertilizer, said VR Raman, the head of policy at WaterAid India, a nonprofit organization that works to improve access to clean water. Such pits will require emptying. “You can imagine on whom the society is going to depend” for that work, he said.

Kaverappa, a small, wiry man who goes barefoot everywhere, has experienced this dynamic firsthand. Over 15 years ago, as Bangalore was expanding, more and more houses were built on the city’s southern periphery. Where there were houses, there were toilet pits to clean. Someone in the neighborhood came to Kaverappa and asked whether he could empty the pits — not because he had done the work before, but because he is Dalit, the community formerly known as “untouchables.”

“This occupation is a caste-based occupation all over India,” said K. Obalesh, founder of an organization started in 2005 that works to eradicate manual scavenging — the practice of dealing with human waste by hand without protective gear, whether in dry latrines, holding pits, sewers or septic tanks.

Some families have done this work for generations, and others are dependent on it to survive, Obalesh said. The general attitude among state and local authorities is one of “acute negligence,” he said. “They’re not interested in implementing [rehabilitation] schemes and breaking the cycle.”

There is no comprehensive count of how many workers engage in manual scavenging in India. The government recently carried out a survey in a quarter of India’s districts and found at least 40,000. But such figures understate the scope of the problem, activists say. Obalesh estimates that there are 20,000 such workers in the state of Karnataka alone.

A few cities are starting to introduce technology in an attempt to end the practice. In Delhi, local authorities have procured more than 200 trucks with specially designed jets and rods to eliminate the need for humans to enter sewers. But some of the drains and sewers in the country are so old — or located in such narrow lanes — that “no machinery fits that purpose,” said Nirat Bhatnagar, a partner at Dalberg Advisors, a development consulting firm.

Meanwhile, it will take far more than building toilets to solve such sanitation challenges. Bezwada Wilson, a prominent activist who heads an organization called the Sanitation Workers Movement, calls the government’s approach “madness.” They are “constructing toilets, but they have not developed the infrastructure for where the human excreta will go and how this is getting emptied.”

In early October, Muttaiah, 63, a social worker in Bangalore who goes by only one name, said he was on his motorbike when he saw one man standing above a manhole and another inside it. It was Oct. 2, the birthday of India’s revered independence leader Mohandas Gandhi. Modi used the occasion to hail the achievements of the cleanliness campaign.

Muttaiah said the man inside the stinking manhole was working without any safety equipment — no gloves, no shoes, no supplemental oxygen. The men told Muttaiah that a local contractor hired by a city engineer had paid them to clean the sewer. Muttaiah took photos and videos and went to the police to file a complaint. (The Washington Post reviewed the photos and the police complaint.) “If there are convictions and somebody is punished, it will be a strong message to the society,” he said.

E. Vishwanath, chief engineer for solid waste management with the Bangalore city government, disputed such reports. “We have supplied all the safety equipment,” he said, although some workers “may not be using it.”

The law entitles manual scavengers to a one-time rehabilitation payment and a loan to help them transition to a new profession. In practice, however, such benefits are difficult to access. Kaverappa knows what he would do if he was given a loan: buy a tanker truck with suction hoses that would allow him to get out of the pit.

When asked what equipment he uses now, Kaverappa held out his two hands. Like his father before him, he has been a manual laborer all his life. His earliest memories are of working: He began breaking stones to use in construction and road-building from the age of 7. “How could I go to school?” he asked. “If I go to school, then there would be nothing to eat at home.”

When he was 20, he began loading stones into trucks, together with several other men from the Dalit community. It was backbreaking work from dawn to dusk, and he lost the top of his right index finger in an accident. Kaverappa’s two younger brothers died of tuberculosis and kidney disease before the age of 40. His son died at 17 from a spinal injury that he said doctors never took the time to explain.

Climbing down into pits to empty fecal sludge with nothing more than a bucket was difficult at first, Kaverappa said, especially the smell. Unlike loading trucks full of rocks, however, it is over within a few hours. He earns about $100 a month.

On a recent morning, he and two relatives arrive to empty two deep pits full of bubbling waste behind a spacious two-story home. One of his relatives, who poured the buckets of waste into plastic drums, had been drinking — a common tactic to cope with this type of work. Even as the men are emptying the pit, people inside the home are using the toilet, sending fresh waste cascading into the cylindrical hole.

After the pit is partially empty, Kaverappa clambers down and lifts bucket after bucket of thick waste over his head. When the job is done, he climbs out and stands in the nearby lane, his small frame smeared with muck. Two women walk by in brightly colored tunics and flowing pants, purses swinging. They do not even glance at him as they pass.

CS Sharada Prasad in Bangalore and Tania Dutta in New Delhi contributed to this report.