Donald J. Trump threatened to sue The New York Times for libel on Wednesday night in response to an article that featured two women accusing him of touching them inappropriately years ago, but the newspaper defended its reporting and told Mr. Trump’s lawyer that “we welcome the opportunity to have a court set him straight.”

The threat of legal action comes as the Trump campaign has been ensnared in controversy after the release of a video last week that showed the Republican nominee for president demeaning women and bragging about being able to force himself on women without consequence. During a presidential debate on Sunday night, Mr. Trump said that it was just “locker-room talk” and that he never did those things.

Mr. Trump told The Times that the allegations of the two women were false and his lawyer, Marc E. Kasowitz, demanded that the newspaper retract the story and issue an apology.

“Your article is reckless, defamatory and constitutes libel per se,” Mr. Kasowitz wrote. “It is apparent from, among other things, the timing of the article, that it is nothing more than a politically motivated effort to defeat Mr. Trump’s candidacy.”