Can magnesium deficiency in blood affect the heart?

Can magnesium deficiency in blood affect the heart?

Magnesium deficiency in blood (hypomagnesemia) can cause irregularities in heart rhythm. It will also make correction of co-existent potassium deficiency (hypokalemia) difficult because magnesium is a cofactor for the enzyme which conserves potassium in the kidney. Hence correction often involves supplementation of both magnesium and potassium. Life threatening ventricular arrhythmias can occur in severe magnesium and potassium deficiency. Intravenous magnesium sulphate is an inexpensive drug sometimes very useful in life threatening ventricular arrhythmia.