We consider a Josephson junction system installed with a finite length inhomogeneity, either of micro-resistor or micro-resonator type. The system can be modelled by a sine-Gordon equation with a piecewise-constant function to represent the varying Josephson tunneling critical current. The existence of pinned fluxons depends on the length of the inhomogeneity, the variation in the Josephson tunneling critical current and the applied bias current. We establish that a system may either not be able to sustain a pinned fluxon, or – for instance by varying the length of the inhomogeneity – may exhibit various different types of pinned fluxons. Our stability analysis shows that changes of stability can only occur at critical points of the length of the inhomogeneity as a function of the (Hamiltonian) energy density inside the inhomogeneity – a relation we determine explicitly. In combination with continuation arguments and Sturm–Liouville theory, we determine the stability of all constructed pinned fluxons. It follows that if a given system is able to sustain at least one pinned fluxon, a microresistor has exactly one pinned fluxon, i.e. the system selects one unique pinned stable pinned configuration, and a microresonator has at least one stable pinned configuration. Moreover, it is shown that both for micro-resistors and micro-resonators this stable pinned configuration may be non-monotonic – something which is not possible in the homogeneous case. Finally, it is shown that results in the literature on localised inhomogeneities can be recovered as limits of our results on micro-resonators.