Lebanon 's prime minister formed a cabinet Monday that includes the militant group Hezbollah and its allies , ending a political deadlock that left the deeply divided nation without a government for months and threatened to ignite violence .