One of the nation’s largest mortgage servicing companies has agreed to pay $2.1 billion in a joint state-federal settlement that could be worth more than $40 million to Connecticut borrowers.

The Consumer Financial Protection Bureau and 49 state attorneys general announced that Atlanta-based Ocwen Financial Corp. and its subsidiary Ocwen Loan Servicing pushed borrowers into foreclosure through illegal actions, such as failing to promptly and accurately credit mortgage payments.