WASHINGTON — Congress finalized a long-stalled bill Thursday to combat sexual harassment in lawmakers' offices, a measure inspired by a flurry of scandals involving Texan Blake Farenthold and others.

Under the legislation, lawmakers will be held personally liable for any harassment they commit and will no longer be able to use taxpayer funds to settle claims, as Farenthold and others had done.

The bill goes to President Donald Trump for his signature after clearing both chambers unanimously on Thursday, the day after negotiators broke a deadlock between the House and Senate versions.

Farenthold, a Corpus Christi Republican, abruptly left office in April, cutting short a House ethics investigation into crude and verbally abusive behavior in his congressional office.

He announced last December that he would not seek re-election after revelations that he had used $84,000 in public funds to settle claims by a former employee. He promised to repay the money to the U.S. Treasury but later changed his mind.

WATCH: Sen. Klobuchar speaks on the Senate floor about her bipartisan legislation with @RoyBlunt to reform the process for workplace harassment and discrimination claims in Congress pic.twitter.com/pmSvRfoV7g — Senator Amy Klobuchar (@SenAmyKlobuchar) December 13, 2018

{"errors":[{"message":"Sorry, that page does not exist","code":34}],"raw":"{\"errors\":[{\"message\":\"Sorry, that page does not exist\",\"code\":34}]}","providerType":"twitter","providerLink":"https://api.twitter.com/1/statuses/oembed.{format}","embedType":null}

“The process we have will now protect victims of harassment instead of protecting politicians,” Sen. Amy Klobuchar, D-Minn., who spearheaded the overhaul with Sen. Roy Blunt, R-Mo., said on the Senate floor.

Blunt said the overhaul "sends a clear message that harassment in any form will not be tolerated by the Congress. The reforms in this agreement will, most importantly, strengthen protections for victims and hold members of Congress personally accountable for their misconduct."

The bill overhauls the way workplace discrimination and harassment claims are handled under the Congressional Accountability Act, passed in 1995 — eliminating 90 days of delay before an aide can request an administrative hearing or file a lawsuit, and allowing claims by unpaid interns.

At least $15 million in settlements had been paid out in the last 20 years for harassment or discrimination. More than 1,500 former congressional staffers signed a letter last year demanding better protection for victims.

The final deal holds lawmakers personally liable for any harassment or retaliation they commit. It also requires annual public reports on payouts, and automatic referral to an ethics committee for allegations involving a lawmaker or senior aide.

In a video from Dec. 14, 2017, Farenthold was emotional when talking about the lack of professionalism among his staff and his own fits of rage with aides.

"I allowed a workplace culture to take root in my office that was too permissive and decidedly unprofessional,” he said. “It accommodated destructive gossip, offhand comments, off-color jokes and behavior that in general was less than professional."

In May, he told ABC News that he had changed his mind on repaying the funds, saying that "I have been advised by my attorneys not to repay that."

In August, the Victoria Advocate reported on a deposition Farenthold had given in which he blamed the #MeToo movement for ending his political career.

Three years earlier, while still in Congress, he had tried to secure a federal contract for the chairman of the Calhoun Port Authority, where he now works as a lobbyist. The Advocate had sued the port authority to obtain his hiring records.

"I believe the public attention to the #MeToo movement created a political environment where it would be much more difficult for the members of the Ethics Committee to separate politics from the facts," Farenthold said at his deposition.

Republican Michael Cloud from Victoria won a special election in June to replace Farenthold and won the general election on Nov. 6.