  One can easily give examples of rank 2 flat connections over $\mathbb{P}^2$
by rational pull-back of connections over $\mathbb{P}^1$. We give an example of
a connection that can not occur in this way; this example is constructed from
an algebraic solution of Painlev\'e VI equation. From this example we deduce a
Hilbert modular foliation. The proof of this relies on the classification of
foliations on projective surfaces due to Brunella, Mc Quillan and Mendes. Then,
we get the dual foliation and, by a precise monodromy analysis, we see that our
twice foliated surface is covered by the classical Hilbert modular surface
constructed from the action of $\mathrm{PSL}_2(\mathbb{Z}[\sqrt{3}])$ on the
bidisc.
