An implantable medical system comprising: a first electrode (22, 24, 42) to sense electrical activity of one or both ventricles of a patient's heart or to deliver cardiac therapy to one or both ventricles of the patient's heart; a second electrode (22, 24) to sense electrical activity of one or both atria of the patient's heart; a motion sensor to sense mechanical activity of the patient's heart; and a controller operably coupled to the first electrode, second electrode, and the motion sensor, the controller configured to: switch between a dual-chamber sensing mode to deliver pacing based on sensing electrical activity of at least one atrium and at least one ventricle of the patient's heart and a single-chamber sensing mode to deliver pacing based on sensing electrical activity of only one or both ventricles of the patient's heart; deliver pacing to at least one of the ventricles of the patient's heart using the first electrode in the dual-chamber sensing mode; determine whether the electrical activity of one or both atria sensed by the second electrode is indicative of atrial fibrillation; in response to determining that the electrical activity of one or both atria is indicative of atrial fibrillation, determine whether mechanical activity of the patient's heart sensed by the motion sensor represents atrial contraction; and in response to determining that the mechanical activity of the patient's heart does not represent the atrial contraction, deliver inhibited pacing using the first electrode in the single-chamber sensing mode. a first electrode (22, 24, 42) to sense electrical activity of one or both ventricles of a patient's heart or to deliver cardiac therapy to one or both ventricles of the patient's heart; a second electrode (22, 24) to sense electrical activity of one or both atria of the patient's heart; a motion sensor to sense mechanical activity of the patient's heart; and a controller operably coupled to the first electrode, second electrode, and the motion sensor, the controller configured to: switch between a dual-chamber sensing mode to deliver pacing based on sensing electrical activity of at least one atrium and at least one ventricle of the patient's heart and a single-chamber sensing mode to deliver pacing based on sensing electrical activity of only one or both ventricles of the patient's heart; deliver pacing to at least one of the ventricles of the patient's heart using the first electrode in the dual-chamber sensing mode; determine whether the electrical activity of one or both atria sensed by the second electrode is indicative of atrial fibrillation; in response to determining that the electrical activity of one or both atria is indicative of atrial fibrillation, determine whether mechanical activity of the patient's heart sensed by the motion sensor represents atrial contraction; and in response to determining that the mechanical activity of the patient's heart does not represent the atrial contraction, deliver inhibited pacing using the first electrode in the single-chamber sensing mode. switch between a dual-chamber sensing mode to deliver pacing based on sensing electrical activity of at least one atrium and at least one ventricle of the patient's heart and a single-chamber sensing mode to deliver pacing based on sensing electrical activity of only one or both ventricles of the patient's heart; deliver pacing to at least one of the ventricles of the patient's heart using the first electrode in the dual-chamber sensing mode; determine whether the electrical activity of one or both atria sensed by the second electrode is indicative of atrial fibrillation; in response to determining that the electrical activity of one or both atria is indicative of atrial fibrillation, determine whether mechanical activity of the patient's heart sensed by the motion sensor represents atrial contraction; and in response to determining that the mechanical activity of the patient's heart does not represent the atrial contraction, deliver inhibited pacing using the first electrode in the single-chamber sensing mode.