Senate Judiciary Committee Chairman Chuck Grassley (R-Iowa). (J. Scott Applewhite / AP)

Congress gave final agreement Thursday to curbing a practice used by agencies across government to deal with employees accused of misbehavior: Paid time off that goes on for months and even years.

The annual defense bill that cleared the Senate and now goes to the White House for President Obama’s signature limits the use of administrative leave to 10 work days in a calendar year.

In  a rare agreement on an issue affecting federal employees, Republicans and Democrats in the House and Senate concluded that sidelining thousands of employees every year to often-indefinite paid vacations is not good for government or taxpayers.

The widely used strategy to get problem employees out of the office costs hundreds of millions of dollars a year. Civil servants, from senior executives to GS-7s, from the Department of Homeland Security to the National Archives, have found themselves idled at home with full pay and benefits, hearing little from the managers who are supposed to be resolving their cases.

[Thousands of federal workers on extended paid leave]

Some accused of wrongdoing have broken serious rules, while others have been sent home as retaliation for blowing the whistle on wrongdoing.

An exemption to the 10-day rule will be allowed when an employee is deemed to be a threat to workplace safety. But even in that case, agencies will need to justify leave for longer than 30 days, get permission from higher-ups to continue it and report it to Congress.

[Civil servants on paid leave can get stuck in an ill-defined limbo]

Federal agencies will be required for the first time to track and record their use of administrative leave. And when it’s used as retaliation against a whistleblower, this will be considered a personnel action that can be challenged by the employee.

This limbo has continued despite government personnel rules that limit paid leave for employees facing discipline to “rare circumstances” in which the employee is considered a threat. The rules were written years ago in an effort to curb waste and deal quickly with workers accused of misconduct.

The comptroller general, the top federal official responsible for auditing government finances and practices, has repeatedly ruled that federal workers should not be sidelined for long periods for any reason.

[The government paid $80 million last year for feds to stay home, new analysis reveals]

The widespread use of paid leave was disclosed for the first time by the Government Accountability Office in 2014 in an audit first made public by The Washington Post. It found that 53,000 civilian employees were kept home for one to three months during the three fiscal years that ended in September 2013. About 4,000 of them were idled for three months to a year and several hundred for one to three years, at a cost to taxpayers of more than $700 million.

Since then, an investigation by Sen. Charles E. Grassley (R-Iowa) found that the government’s largest agencies paid out more than $80 million in 2014 for thousands of employees to sit home for a month and longer while they faced allegations of misconduct.

“Paid leave shouldn’t be a crutch for management to avoid making tough personnel decisions or a club for wrongdoers to use against whistleblowers,” Grassley, one of the legislation’s four Senate sponsors, said in a statement.

The legislation won’t take effect for 540 days. That’s because the Office of Personnel Management has 270 days to issue regulations specifying details of the change. Then, agencies have an additional 270 days to update their computer and personnel systems to track who is on paid leave.

Congressional staff who worked on the bill said Thursday it’s not clear whether the thousands of employees now on paid leave — or who will be placed on it in the 540 days — will be forced to go back to work or grandfathered in and told to stay home.