Abstract. We present a new modular Bayesian inversion framework, called FLEXINVERT, for estimating the surface fluxes of atmospheric trace species. FLEXINVERT can be applied to determine the spatio-temporal flux distribution of any species for which the atmospheric loss (if any) can be described as a linear process and can be used on continental to regional and even local scales with little or no modification. The relationship between changes in atmospheric mixing ratios and fluxes (the so-called source-receptor relationship) is described by a Lagrangian Particle Dispersion Model (LPDM) run in a backwards-in-time mode. In this study, we use FLEXPART but any LPDM could be used. The framework determines the fluxes on a nested grid of variable resolution, which is optimized based on the source-receptor relationships for the given observation network. Background mixing ratios are determined by coupling FLEXPART to the output of a global Eulerian model (or alternatively, from the observations themselves) and are also optionally optimized in the inversion. Spatial and temporal error correlations in the fluxes are taken into account using a simple model of exponential decay with space and time and, additionally, the aggregation error from the variable grid is accounted for. To demonstrate the use of FLEXINVERT, we present one case study in which methane fluxes are estimated in Europe in 2011 and compare the results to those of an independent inversion ensemble.