The dynamics of a flexible filament sedimenting in a viscous fluid are explored analytically and numerically. Compared with the well-studied case of sedimenting rigid rods, the introduction of filament compliance is shown to cause a significant alteration in the long-time sedimentation orientation and filament geometry. A model is developed by balancing viscous, elastic and gravitational forces in a slender-body theory for zero-Reynolds-number flows, and the filament dynamics are characterized by a dimensionless elasto-gravitation number. Filaments of both non-uniform and uniform cross-sectional thickness are considered. In the weakly flexible regime, a multiple-scale asymptotic expansion is used to obtain expressions for filament translations, rotations and shapes. These are shown to match excellently with full numerical simulations. Furthermore, we show that trajectories of sedimenting flexible filaments, unlike their rigid counterparts, are restricted to a cloud whose envelope is determined by the elasto-gravitation number. In the highly flexible regime we show that a filament sedimenting along its long axis is susceptible to a buckling instability. A linear stability analysis provides a dispersion relation, illustrating clearly the competing effects of the compressive stress and the restoring elastic force in the buckling process. The instability travels as a wave along the filament opposite the direction of gravity as it grows and the predicted growth rates are shown to compare favourably with numerical simulations. The linear eigenmodes of the governing equation are also studied, which agree well with the finite-amplitude buckled shapes arising in simulations.