Context.Since July 2014, theGaiaspace mission has been continuously scanning the sky and observing the extragalactic Universe with unprecedented spatial resolution in the optical domain (∼180 mas by the end of the mission).Gaiaprovides an opportunity to study the morphology of the galaxies of the local Universe (z < 0.45) with much higher resolution than has ever been attained from the ground. It also allows us to provide the first morphological all-sky space catalogue of nearby galaxies and galaxies that host quasars in the visible spectrum.Aims.We present the Data Processing and Analysis Consortium CU4-Surface Brightness Profile fitting pipeline, which aims to recover the light profile of nearby galaxies and galaxies hosting quasars.Methods.The pipeline uses a direct model based on the Radon transform to measure the two-dimensional surface brightness profile of the extended sources. It simulates a large set of 2D light profiles and iteratively looks for the one that best reproduces the 1D observations by means of a Bayesian exploration of the parameters space. We also present our method for setting up the input lists of galaxies and quasars to be processed.Results.We successfully analysed 1 103 691 known quasars and detected a host galaxy around 64 498 of them (∼6%). We publish the surface brightness profiles of the host for a subset of 15 867 quasars with robust solutions. The distribution of the Sérsic index describing the light profile of the host galaxies peaks at ∼0.8 with a mean value of ∼1.9, indicating that these galaxies hosting a quasar are consistent with disc-like galaxies. The pipeline also analysed 940 887 galaxies with both a Sérsicand a de Vaucouleurs profile and derived robust solutions for 914 837 of them. The distribution of the Sérsic indices confirms thatGaiamostly detects elliptical galaxies and that very few discs are measured.