Collisionless plasma shock theory, which applies for example to the afterglow of gamma ray bursts, still contains key issues that are poorly understood. In this paper we study charged particle dynamics in a highly relativistic collisionless shock numerically using ~10^9 particles. We find a power law distribution of accelerated electrons, which upon detailed investigation turns out to originate from an acceleration mechanism that is decidedly different from Fermi acceleration. Electrons are accelerated by strong filamentation instabilities in the shocked interpenetrating plasmas and coincide spatially with the power law distributed current filamentary structures. These structures are an inevitable consequence of the now well established Weibel-like two-stream instability that operates in relativistic collisionless shocks. The electrons are accelerated and decelerated instantaneously and locally; a scenery that differs qualitatively from recursive acceleration mechanisms such as Fermi acceleration. The slopes of the electron distribution power laws are in concordance with the particle power law spectra inferred from observed afterglow synchrotron radiation in gamma ray bursts, and the mechanism can possibly explain more generally the origin of non-thermal radiation from shocked inter- and circum-stellar regions and from relativistic jets.