He "also strongly condemns the killing of 21 members of a government-backed tribal police force," kidnapped this week after near Peshawar, in the troubled northwest of the country.
"These cruel acts of violence cannot be justified by any cause or grievance," the statement emphasized, saying the perpetrators "should be brought to justice."
Ban assured Pakistan's government and its people of "the solidarity of the United Nations" as well as of "its continued support for their efforts to defend their country's institutions and freedoms in the face of the scourge of terrorism."
A remotely-triggered car bomb in southwest Pakistan hit a convoy of three buses carrying about 180 Shiite Muslim pilgrims to Iran, killing at least 19 of them and wounding 25 others.
It was one of the deadliest attacks this year against Shiite Muslims, who make up about 20 percent of the population of Pakistan.
In the northwest, security forces were hunting the killers of 21 security personnel whose bodies were discovered not far from two camps outside Peshawar where they had been kidnapped by the Pakistani Taliban.