  [Abridged] Context. Stellar activity is an important source of systematic
errors and uncertainties in the characterization of exoplanets. Most of the
techniques used to correct for this activity focus on an ad hoc data reduction.
Aims. We have developed a software for the combined fit of transits and stellar
activity features in high-precision long-duration photometry. Our aim is to
take advantage of the modelling to derive correct stellar and planetary
parameters, even in the case of strong stellar activity. Methods. We use an
analytic approach to model the light curve. The code KSint, modified by adding
the evolution of active regions, is implemented into our Bayesian modelling
package PASTIS. The code is then applied to the light curve of CoRoT-2. The
light curve is divided in segments to reduce the number of free parameters
needed by the fit. We perform a Markov chain Monte Carlo analysis in two ways.
In the first, we perform a global and independent modelling of each segment of
the light curve, transits are not normalized and are fitted together with the
activity features, and occulted features are taken into account during the
transit fit. In the second, we normalize the transits with a model of the
non-occulted activity features, and then we apply a standard transit fit, which
does not take the occulted features into account. Results. Our model recovers
the activity features coverage of the stellar surface and different rotation
periods for different features. We find variations in the transit parameters of
different segments and show that they are likely due to the division applied to
the light curve. Neglecting stellar activity or even only bright spots while
normalizing the transits yields a $\sim 1.2\sigma$ larger and $2.3\sigma$
smaller transit depth, respectively. The stellar density also presents up to
$2.5\sigma$ differences depending on the normalization technique...
