A ventilator provides breathing support to a patient in an EMG controlled mode, and has an input that receives an EMG signal representative of breathing activity from the patient and a control unit for controlling the ventilation in dependence of said EMG signal. The ventilator has a registration unit that registers the actual breathing support provided from the ventilator to the patient, and the control unit determines if there is asynchrony between the EMG signal and the breathing activity and, in case of asynchrony, causes a switch from EMG controlled ventilation to a second ventilation mode not dependent on the EMG signal. If synchrony is detected the ventilator can return to EMG controlled ventilation.