US and Iran agreed a ceasefire, with European leaders urging lasting peace and the reopening of vital oil routes. Pakistan played a key diplomatic role.