In a country increasingly riven by extremism, Abdul Sattar Edhi, the founder of a vast public welfare organisation that spans Pakistan, was a symbol of the country’s shrivelled secular tradition. Edhi, who has died aged around 90, never turned anyone away from his hospitals, homeless shelters, rehab centres and orphanages. His determination to ignore considerations of creed, cast or sect earned him the hatred of some on the country’s religious right, who accused him of being an atheist. But the public revered him for his lifelong commitment to humanity.

Edhi was born in British India but moved to Pakistan six days after it was formed in August 1947. He attended some of the public speeches made by Muhammad Ali Jinnah, the anglicised lawyer who led the movement for a Muslim majority state. Like many others hailing from Gujarat, Edhi found himself in Karachi, arriving by boat in the Arabian Sea entrepot that would grow into a megacity of more than 20 million people, racked by ethnic strife.

Always hazy about the precise year of his birth, Edhi reckoned he was about 20 when he landed at Karachi’s stinking harbour. He initially worked as a street pedlar, hawking pencils, matches that he would hold on a tray and towels. Later he sold paan, the betel leaf and nut mixture chewed by many in the subcontinent, and then worked for his father who was a trader. But he found his time doing this unsatisfying.

He said he felt an urge to do welfare work after “observing the environment I was living in, where injustice, bribery and robbery were common”. He set up his first simple pharmacy offering drugs and basic medical care, regardless of people’s ability to pay, in a tent next to his family home in Jodia bazaar.

The area, now a teeming slum, is still the headquarters of the Edhi Foundation, which is run out of a ramshackle building where he lived to the end of his days in a tiny backroom. Doctors were persuaded to offer their services free and he raised the money to pay for medicines. Even in old age, he could still be seen on the streets stopping passers-by and cars for cash donations, with no one asking for receipts.

Edhi’s charitable activities expanded in 1957 when an Asian flu epidemic swept through Karachi. He borrowed money for tents to treat people who were only asked to contribute financially if they could afford it. “It was the first mass recognition of my work,” Edhi later told the journalist Steve Inskeep. A single generous donation from a businessman, a fellow member of the Memon community, allowed Edhi to buy his first ambulance, which he drove himself around the city. Once asked why he was prepared to help Christians and Hindus alike, Edhi replied, “because my ambulance is more Muslim than you”. A women’s dispensary would later open and then a maternity clinic.

Through his work, Edhi met Bilquis Bano, who became his wife and a key figure in the burgeoning charity empire. They worked together during one of the toughest periods of Edhi’s life, the 1965 war between India and Pakistan which saw Karachi bombed. The couple cared for the civilian victims and organised 45 funerals, with Bilquis cleaning the bodies of women and Edhi preparing the men for burial. It was said he washed thousands of dead bodies during his life, with his foundation finding space in its graveyards for anyone who needed it. In his memoir, A Mirror to the Blind, he made clear his distaste for anyone who thought themselves too grand to touch the dead.

The Edhi Foundation ultimately became a multimillion-dollar enterprise run directly by Edhi, his wife and their four children. It is most famous for its fleet of 1,500 minivan ambulances that are always first on the scene of an accident or, more frequently, in the last decade terrorist attack. The foundation estimates it transports a million people to hospital each year, charging a tiny fee for the ride. In Karachi, rival gangs have been known to call temporary ceasefires to their gun battles to allow Edhi’s minimally trained ambulance staff to collect the dead and wounded.

In a country with a negligible public welfare system Edhi offered cradle-to-grave services. Some 20,000 people have Edhi registered as a parent or guardian after he and his wife began taking in abandoned babies. They started to place cribs outside their offices where unwanted infants could be left. It was a court case filed by Edhi that ultimately won the right for abandoned children with unknown parents to get the vital national identity card.

“I have never been a very religious person,” he told the Daily Times newspaper in 2009. “I am neither against religion nor for it.” He found inspiration in socialist writers who lambasted the ruling capitalist class whom he thought were responsible for poverty in the world. And he did not see why work to alleviate suffering should be restricted to Pakistan. In 2005 the Edhi Foundation donated $100,000 to the victims of Hurricane Katrina in the US.

“My religion is serving humanity and I believe that all the religions of the world have their basis in humanity,” he said.

Edhi is survived by Bilquis and their two daughters and two sons.

• Abdul Sattar Edhi, social campaigner, born c1926; died 8 July 2016