Seasonal thermal energy storage is an effective measure to enable a low carbon future through the integration of renewables into the energy system. Borehole thermal energy storage (BTES) provides a solution for long-term thermal energy storage and its operational optimization is crucial for fully exploiting its potential. This paper presents a novel linearized control-oriented model of a BTES, describing the storage temperature dynamics under varying operating conditions, such as inlet temperature, mass-flow rate and borehole connection layouts (e.g. in-series, in-parallel or mixed). It supports an optimization framework, which was employed to determine the best operating conditions for a heat pump-driven BTES, subject to different CO2 intensity profiles of the electricity. It was demonstrated that this boundary condition, due to its seasonal variation, is critical for the optimal operation of the system, as increasing heat pump efficiency in winter while accepting a lower one in summer can be beneficial. Results for an exemplary district case, subject to two different CO2 intensity profiles, show that a lower relative intensity in summer compared to the one in winter leads to a higher optimal operating temperature of the storage. The district system studied is heating-dominated, effectively enabling the BTES to cover only 20% of the total heat demand, leading to limited total yearly CO2 emissions savings of 2.2% to 4.3%. When calculating the benefits associated with the heating and cooling demand handled by the BTES, a higher CO2 emission reduction in the range of 12.8%���19.9% was found. This highlights the BTES potential when subject to more balanced loads.