We quantify in more detail than earlier studies the cost trade-offs of establishing import-export links between Europe and North Africa for two quintessential energy carriers needed for the energy transition: electricity and hydrogen. Using the TIAM-ECN model, we show under what assumptions Europe will make a net energy system cost gain or, inversely, pay a net price for exploiting such interlinkages. We find that allowing for trade of renewable energy between Europe and North Africa substantially reduces the EU's domestic renewable energy capacity investments needed to implement its Green Deal and Fit for 55 Programme. In addition to creating import-export scenarios for electricity and hydrogen across the Mediterranean and investigating the cost implications of a European-African energy partnership until 2050, we perform a detailed sensitivity analysis regarding possible technological developments and sectoral shifts, as well as vis-à-vis potential cost, sectoral and technical asymmetries between Europe and North Africa. We introduce a new concept in energy analysis, autarky penalty, which is the price paid by a region for restricting energy trade with its neighbors. If domestic hydrogen production from solar and wind energy through electrolysis is constrained, Europe's autarky penalty may increase to 30 billion $ annually by 2050.