The attack has raised alarm that insurgent violence, confined in recent years to Pakistan’s western regions, has reached its urban centers.