We investigate long-range pairing interactions between ultracold fermionic atoms confined in an optical lattice which are mediated by the coupling to a cavity. In the absence of other perturbations, we find three degenerate pairing symmetries for a two-dimensional square lattice. By tuning a weak local atomic interaction via a Feshbach resonance or by tuning a weak magnetic field, the superfluid system can be driven from a topologically trivial s-wave to topologically ordered, chiral superfluids containing Majorana edge states. Our work points out a novel path towards the creation of exotic superfluid states by exploiting the competition between long-range and short-range interactions.Ultracold fermionic gases form an ideal platform for a new generation of quantum technologies [1,2], and for the quantum simulation of many-body phenomena [3,4] such as superfluidity [5,6]. Their key feature for these applications is that local (on-site) atomic interactions can be tuned very precisely using Feshbach resonances to explore, e.g, the crossover from BCS to BEC regimes [7], quantum simulation of the Fermi Hubbard model [8], and strongly correlated fermions in reduced dimensions [9][10][11][12]. Coupling ultracold atoms to optical cavities [13][14][15][16][17][18][19][20][21][22] promises to extend this control to longranged interactions.