A motor controller comprising: an inverter configured to apply a voltage to each phase of a motor having coils (1U,1V,1W) of three or more phases arranged in star connection so as to supply an alternate current to each phase; a neutral line which grounds a neutral point of the star connection; a phase current detector configured to detect the current flowing in each phase of the motor; a magnetic pole detector configured to detect a magnetic pole rotational position of the motor; and a d-q-0 transformer configured to transform the current of each phase detected by the phase current detector to a rectangular coordinate system of the d-axis current, the q-axis current, and a 0-axis current, by using the magnetic pole rotational position detected by the magnetic pole detector as a parameter, the current supplied to each phase of the motor being controlled based on target values of a q-axis current and a d-axis current which are equivalent to target torque, a current of each phase detected by the phase current detector, and the magnetic pole rotational position detected by the magnetic pole detector, the motor controller being characterized in that it comprises: a 0-axis current calculator configured to calculate a target value of the 0-axis current by setting the current of the open phase to be zero when one of the phases of the motor becomes open and no current flows to the one of the phases, or determines that the target value of the 0-axis current is zero when there is no open phase, and based on the target values of the d-axis current and the q-axis current, the target value of the 0-axis current calculated by the 0-axis current calculator, and the d-axis current, the q-axis current, and the 0-axis current transformed by the d-q-0 transformer, the current supplied to each phase of the motor and a 0-phase current flowing in the neutral line being controlled. an inverter configured to apply a voltage to each phase of a motor having coils (1U,1V,1W) of three or more phases arranged in star connection so as to supply an alternate current to each phase; a neutral line which grounds a neutral point of the star connection; a phase current detector configured to detect the current flowing in each phase of the motor; a magnetic pole detector configured to detect a magnetic pole rotational position of the motor; and a d-q-0 transformer configured to transform the current of each phase detected by the phase current detector to a rectangular coordinate system of the d-axis current, the q-axis current, and a 0-axis current, by using the magnetic pole rotational position detected by the magnetic pole detector as a parameter, the current supplied to each phase of the motor being controlled based on target values of a q-axis current and a d-axis current which are equivalent to target torque, a current of each phase detected by the phase current detector, and the magnetic pole rotational position detected by the magnetic pole detector, the motor controller being characterized in that it comprises: a 0-axis current calculator configured to calculate a target value of the 0-axis current by setting the current of the open phase to be zero when one of the phases of the motor becomes open and no current flows to the one of the phases, or determines that the target value of the 0-axis current is zero when there is no open phase, and based on the target values of the d-axis current and the q-axis current, the target value of the 0-axis current calculated by the 0-axis current calculator, and the d-axis current, the q-axis current, and the 0-axis current transformed by the d-q-0 transformer, the current supplied to each phase of the motor and a 0-phase current flowing in the neutral line being controlled. a 0-axis current calculator configured to calculate a target value of the 0-axis current by setting the current of the open phase to be zero when one of the phases of the motor becomes open and no current flows to the one of the phases, or determines that the target value of the 0-axis current is zero when there is no open phase, and based on the target values of the d-axis current and the q-axis current, the target value of the 0-axis current calculated by the 0-axis current calculator, and the d-axis current, the q-axis current, and the 0-axis current transformed by the d-q-0 transformer, the current supplied to each phase of the motor and a 0-phase current flowing in the neutral line being controlled.