Peer-to-peer (P2P) energy trading for profit-driven communities in distribution networks (DNs) has become increasingly critical in terms of economic view especially in the absence of supportive subsidies for renewable generation. However, the risk behavior of local energy communities (LECs), as well as their inherent flexibility options, can affect the profit achieved through local energy trading. This paper seeks to carefully examine to what extent the aforementioned factors contribute to the economic value of P2P energy trading for LECs. To do this, a mathematical model is developed as a multi-leader–multi-follower game which is formulated as equilibrium problems with equilibrium constraints (EPEC). In this game, operators of different LECs are leaders while the market operator who is in charge of clearing the local community market and the distribution system operator (DSO) who is responsible for addressing security constraints of the grid are deemed as followers. In addition, the conditional value at risk (CVaR) technique is utilized to model the risk-averse behavior of communities’ operators. Finally, the model is implemented into a typical DN modified by three different types of LECs. The findings of the simulation highlight that P2P energy trading can bring financial gains for a typical community under certain conditions. Flexibility originated from distributed energy resources (DERs) and sector coupling within a community provide more profit in local energy trading for the community, but risk-averse strategies have the opposite effect.