Abstract This article investigates the inverse problem of determining the source term of the hyperbolic equation for electromagnetic propagation using terminal data. This study is an important method for identifying propagation sources in electromagnetics. Unlike wave equations, the complexity of the underlying equations can make theoretical analysis quite difficult. Firstly, the uniqueness of the inverse problem was proved using the energy method. Then, based on the optimal control framework, the inverse problem was transformed into an optimal control problem, and the existence of the optimal solution and its necessary conditions were established. Secondly, the global uniqueness and stability of the optimal solution have been proven, which is a completely new conclusion. This has laid a solid theoretical foundation for numerical algorithms. Finally, it is proposed to apply the Landweber iteration method and conjugate gradient method to this problem, and some numerical examples are provided to demonstrate the effectiveness and convergence speed of these two algorithms.