A maximum-principle approach to the minimisation of a nonlocal dislocation energy