A quadratic Leibniz algebra (V, [·, ·], κ) gives rise to a canonical Yang-Mills type functional S over every space-time manifold. The gauge fields consist of 1-forms A taking values in V and 2-forms B with values in the subspace W ⊂ V generated by the symmetric part of the bracket. If the Leibniz bracket is anti-symmetric, the quadratic Leibniz algebra reduces to a quadratic Lie algebra, B ≡ 0, and S becomes identical to the usual Yang-Mills action functional. We describe this gauge theory for a general quadratic Leibniz algebra. We then prove its (classical and quantum) equivalence to a Yang-Mills theory for the Lie algebra g = V/W to which one couples massive 2-form fields living in a g-representation. Since in the original formulation the B-fields have their own gauge symmetry, this equivalence can be used as an elegant mass-generating mechanism for 2-form gauge fields, thus providing a "higher Higgs mechanism" for those fields.