The flow in the atmospheric boundary layer (ABL) over cities is crucial for the urban climate as it controls the exchange of heat, moisture and pollutants within the ABL and with the surroundings. In particular for cities in mountainous terrain, the mesoscale flow shows a high spatial and temporal variability, which poses great challenges to the means of observation. We used the dual-Doppler lidar scan strategy of virtual towers (VT), to measure profiles of the horizontal wind in the ABL over the city of Stuttgart in southwestern Germany. To study the mesoscale variability of the horizontal wind, we placed six VTs in the topographically structured investigation area, which is characterised by a basin-shaped valley opening into a major valley. Comparisons with radiosonde data show that reliable wind information can be retrieved from the VT measurements after careful processing. A statistical analysis reveals a strong dependence of the flow in the valleys below ridge height on the bulk Richardson number (BRN). A critical BRN of 1.25 is identified for the area, below which the flow below ridge height is dynamically unstable and coupled to the ambient flow above. ... mehrFor BRNs greater than 1.25, the flow is dynamically stable and the flow below ridge height is dominated by thermally driven down-valley winds, which are decoupled from the ambient wind. This study shows that the VT technique is applicable in highly complex terrain and a promising tool for the investigation of the flow in areas which are difficult to access by traditional in situ or single lidar measurements, like complex urban terrain.