  We show that every action of a finitely generated group on a finite-rank
median algebra admits a nonempty "convex core", even when no metric or topology
is given. We then use this to deduce an analogue of the flat torus theorem for
actions on connected finite-rank median spaces. We also prove that isometries
of connected finite-rank median spaces are either elliptic or loxodromic.
