Direct current (DC) microgrids can be considered as cyber-physical systems due to implementation of measurement devices, communication network, and control layers.Consequently, dc microgrids are also vulnerable to cyber-attacks.False-data injection attacks (FDIAs) are a common type of cyber-attacks, which try to inject false data into the system in order to cause the defective behavior.This article proposes a method based on model predictive control (MPC) and artificial neural networks (ANNs) to detect and mitigate the FDIA in dc microgrids that are formed by parallel dc-dc converters.The proposed MPC/ANNbased strategy shows how MPC and ANNs can be coordinated to provide a secure control layer to detect and remove the FDIAs in the dc microgrid.In the proposed strategy, an ANN plays the role of the estimator to implement in the cyber-attack detection and mitigation strategy.The proposed method is examined under different conditions, physical events and cyber disturbances (i.e.load changing and communication delay, and time-varying attack), and the results of the MPC-based scheme is compared with conventional proportional-integral controllers.The obtained results show the effectiveness of the proposed strategy to detect and mitigate the attack in dc microgrids.