President Donald Trump signed legislation Friday that prevents debt collectors from seizing veterans' disability compensation if they declare bankruptcy.

The Honoring American Veterans in Extreme Need, or HAVEN, Act extends the same protection for veterans disability payments that's afforded Social Security disability payments: By law, debt collectors are now not allowed to count these benefits as disposable income subject to seizure during a bankruptcy.

The bipartisan legislation, introduced earlier this year by Rep. Lucy McBath, D-Georgia, in the House and Sens. Tammy Baldwin, D-Wisconsin, and John Cornyn, R-Texas, in the Senate, passed by voice vote in both legislative bodies and was widely hailed by veterans groups.

"Our disabled veterans should never be penalized for injuries they sustained in service to our country. They have earned their benefits, and it's our duty to stand up for them if they fall on tough times," McBath said.

"By protecting their disability compensation during bankruptcy, we can help [veterans] and their families regain financial stability," Cornyn said after the Senate passed the measure.

Social Security disability payments have long received protection from bankruptcy creditors. When the HAVEN bill was introduced, Holly Petraeus, former assistant director of the Consumer Financial Protection Bureau, said she was "surprised and dismayed" that disabled veterans' disability income was not shielded in the same manner.

"As someone who has spent her life in the military community, I know that many veterans have paid for their dedicated service with lifelong disabilities. It should be a priority for all of us to see that they are treated fairly under the law," she said.

The president also signed an extension of the National Guard and Reservists Debt Relief Act, which offers protection during bankruptcy proceedings to members who serve for at least 90 days on active duty.

The legislation ensures that members of the National Guard and Reserves, who may earn higher pay while serving on active duty than they make in their civilian jobs, are not assessed at the higher pay bracket if they file for bankruptcy.

The law signed by Trump extends the protections for four years. It was set to expire in December.