The suspect, 48, said to be known to authorities on child custody issues, was later found dead, officials said.
A woman had fled to the roof of a house in a remote village near Saint-Just in the early hours of Wednesday.
The gunman killed one officer and wounded another. He then set fire to the house and killed two more officers who arrived. The woman was rescued.
President Emmanuel Macron said the nation shared the grief of the families of the police officers.
Elite tactical police officers were at the scene on Wednesday in the village in the Puy-de-Dôme department, in France's Massif Central mountain region.
As the sequence of events became clear, prosecutor Eric Maillaud described the scene as a "real war zone" as he described a man who had been in conflict with his wife and had an arsenal of weapons. "What's certain is that he was totally battle-hardened in handling weapons," he told reporters.
The mayor of Saint-Just, François Chautard, said initially that the house had burned down but it took police time to confirm that the suspect was dead, and the prosecutor said an initial examination of his body suggested he had taken his own life.
Police told French media that he had been found dead in his car nearby. He was named locally as Frédéric Limol and described as a shooting enthusiast with a disturbing profile.
Interior Minister Gérald Darmanin visited the scene and named the first officer who died as Brig Arno Mavel, 21, and the two who died in the second incident as Lt Cyrille Morel, 45, and Adjutant Rémi Dupuis, 37.