We test the hypothesis that interconnections across financial institutions can be explained by a diversification motive. This idea stems from the empirical evidence of the existence of long-term exposures that cannot be explained by a liquidity motive (maturity or currency mismatch). We model endogenous interconnections of heterogenous financial institutions facing regulatory constraints using a maximization of their expected utility. Both theoretical and simulation-based results are compared to a stylized genuine financial network. The diversification motive appears to plausibly explain interconnections among key players. Using our model, the impact of regulation on interconnections between banks -currently discussed at the Basel Committee on Banking Supervision- is analyzed.