Computational inverse design has been a driving force behind the development of compact and highly efficient nanophotonic devices. However, due to fabrication constraints, devices have so far mostly been restricted to planar geometries. With recent developments, additive manufacturing techniques are poised to open up a vast design space for free-form nanophotonic devices, bringing with them a new set of inverse design challenges. The most urgent one is structural integrity. With a technique such as 3D laser lithography (nearly) every structure can be written, but not every structure is self supported and is with that feasible; free-floating elements are simply not an option. To address this challenge, we present here a method for the inverse design of nanophotonic devices that combines electromagnetic and structural topology optimization. To illustrate the proposed method, we present designs for a nanolens and a mode converter with structural integrity. We show that some of these designs achieve efficiencies comparable to those of conventional nanophotonic inverse design while maintaining structural integrity; and even slightly surpass them. ... mehrThis opens up new possibilities for photonic device design and may lead to the development of novel photonic devices for additive manufacturing.