KARACHI, Pakistan - Bodies are piling up in Pakistan's largest city as it suffers one of its most violent years in history, and concern is growing that the chaos is giving greater cover for the Taliban to operate and undermining the country's economic epicenter.

Karachi, a sprawling port city on the Arabian Sea, has long been beset by religious, sectarian, and ethnic strife. Here armed wings of political parties battle for control of the city, Sunnis and Shiites die in tit-for-tat sectarian killings, and Taliban gunmen attack banks and kill police officers. With an election due next year, the violence could easily worsen.

According to the Citizens' Police Liaison Committee, a civic organization that works with police to fight crime, the violence has claimed 1,938 lives as of late November, the deadliest year since 1994, when the CPLC began collecting figures. Police tallies put the dead at 1,897 through mid-October.

The Taliban seems to be taking advantage of the chaos to expand their presence in the city, a safe distance from areas of Pakistani army operations and U.S. drone strikes.

Security officials say the Taliban raises money in Karachi through bank and ATM robberies, kidnappings, and extortion, and is recruiting. The head of the city's Central Investigation Department, Chaudhry Aslam, who is tasked with tracking down militants, said the Taliban has killed at least 24 of his officers this year. Regular citizens are often caught in the middle.

Part of Karachi's problem is that since 1947 its population has mushroomed from 435,000 to 18 million. The metropolis ranges from the high-end neighborhoods of Clifton where people live behind bougainvillea-covered walls and eat arugula and fig salads at posh restaurants, to concrete block houses on the dusty outskirts. There migrants move in from the rugged northwest where the U.S. is waging its war with the Taliban, and from the flood-prone plains of Sindh.

That population growth is marked by spurts of violence. Currently the overarching struggle appears to be between two powerful forces. One is the Muttahida Quami Movement, the city's dominant force, which represents Urdu-speaking Mohajirs. The other is the Awami National Party. It represents Pashtuns whose numbers are increasing as their ethnic kin flee the northwest.

The MQM prides itself on being the protector of middle-class, liberal, secular values in a country where extremism and religious conservatism hold sway. It says the Taliban began moving into Karachi in force, driven south by a military offensive in 2009, and is wreaking havoc while hiding among the Pashtun.

"We are trying our level best to keep Karachi alive," said Engr Nasir Jamal, of the MQM.