Nissan Motor Co.'s decision to keep investing in Britain came after the carmaker told the government it might shut down manufacturing in the country once it leaves the European Union, according to a person familiar with the private discussions.

The automaker announced Thursday it will start making the X-Trail sport utility vehicle and the next-generation Qashqai at the Sunderland plant.

However, only a month ago it warned that possible tariffs could damage investment in the country's biggest car factory. The sudden shift drew questions about what assistance the government may have promised to keep Nissan in the U.K.