Global decarbonization efforts, along with domestic pressures to diversify the economy, have created challenges and opportunities for the Qatari energy system. The government is focused on diversifying the national economy away from hydrocarbons, encouraging sustainable use of resources, and ensuring the security of food, energy, and water systems. Our optimization framework allows policymakers to apply a systems approach to the overall energy infrastructure in Qatar, covering a range of sectors such as industry, residential infrastructure, transportation, and agriculture. Our aims are twofold: first, to develop an open-source tool that can be used for national-level planning and policymaking, and second to use this tool to generate key technology and policy insights that can aid the transition of Qatari energy infrastructure in the long term. Our results provide a blueprint for a cross-sectoral energy transformation: from greater use of low-carbon transport such as electric cars and public transit, to grid-scale adoption of solar energy and reverse osmosis for desalination. Liquefied natural gas is not expected to remain the most economical export, instead being replaced by hydrogen obtained from the steam reforming of natural gas. We have modeled a long-term domestic divestment from hydrocarbon exports and have shown that the country can still retain significant economic wealth in a post-carbon world, thus maintaining existing political, economic, and social structures.