Walmart wants to make sure its employees who take time off to serve in the military never have to take a pay cut.

The company on Tuesday announced a new pay policy for all full-time and part-time workers who leave for voluntary or involuntary military assignments. Walmart's pledge is to cover the difference in pay any time an employee's military salary is less than what he or she makes working at the store.

So even when a worker is on a military assignment, they're now guaranteed to earn at least as much as they would working as a civilian at Walmart.

The policy covers any military assignment longer than three days.

The company already offers differential pay to some active service members. But this policy change vastly expands the existing program, and it now covers employees who want to do "voluntary services," which includes basic training.

Walmart says it will become "one of the first major retailers" to offer such comprehensive coverage.

Related: Walmart adding 10,000 U.S. jobs

Walmart said the policy will now allow employees who are thinking about enlisting in the military "to do so without fear of losing wages during training."

Gary Profit, a former Brigadier General in the armed forces who is now director of military programs at Walmart (WMT), said the "lion's share" of Walmart workers who leave for military duty would take a pay cut without the program.

Soldiers don't typically draw a large salary, especially those who are newly enlisted. On its website, the U.S. Army says that soldiers with less than two years of experience make about $19,200 per year, or about $9.23 per hour. And the Army says that pay is slightly lower for the first four months of service.

Walmart, meanwhile, has increased its pay in recent years after it was targeted by Fight for $15, a grassroots movement that lobbies for higher minimum wages.

In February 2016, the company boosted its minimum wage to $10 per hour from $9. Walmart said this week that its full-time workers now make an average of $13.60 per hour. The company's maximum hourly wage is $24.70.

Related: Robots could wipe out another 6 million retail jobs

Walmart is also in the middle of a massive push to hire veterans. The company has promised to hire 250,000 veterans who have been honorably discharged from service by the end of 2020.

Profit, Walmart's director of military programs, said the company has already hired 170,000 veterans since 2013.