Markel Corp. said Wednesday that it has agreed to buy Alterra Capital Holdings for about $3.13 billion. Each Alterra common share will be converted into the right to receive 0.04315 Markel common shares plus $10 million in cash. The deal is expected to close in the first half of 2013. Markel will end up owning 69% of the combined company wile Alterra will have about 31%. Alterra, a reinsurer, is backed by Stone Point Capital. Citigroup advised Markel while BofA Merrill Lynch provided financial advice to Alterra.