With Iraq on edge, prime minister’s resignation sets up political crisis