Lebanon’s army chief elected president, showing regional shifts