Two men with extensive criminal histories have been denied bail over an attack on a synagogue which police allege was motivated by hate.