On the microscopic theory of the magnetoelectric effect