The problem is focusing. The intensity at the target goes down with r^-2, and the optics of your laser rifle have to have a certain dimension for certain ranges. That means you'll have to have some moving optics for your rifle, and you'll have to keep the muzzle very clean (believe me, dirt on lenses is not good at all). So yeah, you'll have moving parts, very much like a camera objective. And that shit is sensitive.
And lasers being robust... No. For a weaponised system you'll either want to use a direct diode laser (giving you shitty beam quality but maximum efficiency) or a fiber laser (less efficient [although not much], but higher beam quality and compared to other solid state lasers much easier to use). All the components need stable temperatures, the optics and fier couplings need to be set up with quite some care, and any kind of dirt will ruin your day.
I guess one way around the problem with dirt is to have the final lens behind an aperture that only opens for the shot, and some other possibilities to ruggedize the laser.
But the worst is that lasers will be near useless in bad weather. Heavy rain will refract and scatter your laser pulses quite badly, and foggy conditions are even worse.
Oh, and the usage of such weapons in civilian areas will lead to many, many cases of blindness unless all the civilians have protective glasses like the soldiers.