Michael Cohen took aggressive steps to collect on a multimillion-dollar debt in October 2016, at the time he was seeking to come up with $130,000 to pay a former adult-film star for agreeing to keep quiet about an alleged sexual encounter with Donald Trump.

The debt stemmed from a loan to a French investor who a year earlier had bought Mr. Cohen out of a Manhattan condominium transaction, producing a large profit for Mr. Cohen, according to three people familiar with the transaction. With the investor, Christophe Escoffier, in arrears, Mr. Cohen filed to foreclose on the loan on Oct. 18, 2016, seeking immediate payment less than two weeks before it was due, court documents show.

The foreclosure action came a day after Mr. Cohen, Mr. Trump’s longtime personal lawyer, missed his second deadline to pay the $130,000 to the adult-film star, Stephanie Clifford, according to people familiar with the matter. The payment failure prompted Ms. Clifford to walk away from the deal, in which she agreed not to tell her story to news organizations.

Ms. Clifford, whose professional name is Stormy Daniels, signed a subsequent hush agreement after Mr. Cohen wired her lawyer the payment on Oct. 27, 2016. Mr. Cohen has said he tapped his home-equity credit line to make the payment. Four days later, he collected more than $3.8 million from Mr. Escoffier.

The legal maneuvering over the loan hasn't previously been reported. According to Ms. Clifford’s representatives, Mr. Cohen said at the time he was missing deadlines to pay the adult-film actress because he hadn’t been able to reach Mr. Trump, who was crisscrossing the country holding campaign rallies.