TRIPOLI, LIBYA — Libya has emerged from its civil war with more than 300 militias and no political consensus on forming a national army, raising concerns that irregular, gun-toting groups could become entrenched and pose a long-term challenge to the government, officials here said. On Monday, Libyan leaders began to establish a new interim government with the authority to create the armed forces, choosing the technocratic Abdurrahim el-Keib as prime minister.