  It is shown that any, possibly singular, Fano variety X admitting a
Kahler-Einstein metric is K-polystable, thus confirming one direction of the
Yau-Tian-Donaldson conjecture in the setting of Q-Fano varieties equipped with
their anti-canonical polarization. The proof exploits convexity properties of
the Ding functional along weak geodesic rays in the space of all bounded
positively curved metrics on the anti-canonical line bundle of X and also gives
a new proof in the non-singular case. One consequence is that a toric Fano
variety X is K-polystable iff it is K-polystable along toric degenerations iff
0 is the barycenter of the canonical weight polytope P associated to X. The
results also extend to the logarithmic setting and in particular to the setting
of Kahler-Einstein metrics with edge-cone singularities. Furthermore,
applications to geodesic stability, bounds on the Ricci potential and
Perelman's entropy functional on K-unstable Fano manifolds are given.
