The future Surface Water and Ocean Topography (SWOT) mission will soon provide Sea Surface Height (SSH) measurements resolving scales of a few tens of kilometers. Over a large fraction of the globe, the SSH signal at these scales is essentially a superposition of a component due to balanced motions (BM) and another component due to internal tides (IT). Several oceanographic applications require the separation of these components and their mapping on regular grids. For that purpose, the paper introduces an alternating minimization algorithm that iteratively implements two data assimilation techniques, each specific to the mapping of one component: a quasi-geostrophic model with Back-and-Forth Nudging for BM, and a linear shallow-water model with 4-Dimensional Variational (4DVar) assimilation for IT. The algorithm is tested with Observation System Simulation Experiments (OSSE) where the truth is provided by a primitive-equation ocean model in an idealized configuration simulating a turbulent jet and a mode-one IT. The algorithm reconstructs almost 80\% of the variance of BM and IT, the remaining 20\% being mostly due to dynamics that cannot be described by the simple models used. Importantly, in addition to the reconstruction of stationary IT, the amplitude and phase of nonstationary IT are reconstructed. Although idealized, this study represents a step forward towards the disentanglement of BM and IT signals from real SWOT data.