Hit man hired, transaction terms discussed, Daniel Mendoza was about to set his plan into motion, authorities say, and go cool his heels in Honduras.

The problem for the Rockville resident: The hit man was really an undercover police officer, and Mendoza now faces charges of conspiring to kill his estranged wife and her boyfriend, according to court papers made public Wednesday.

“He poses an immediate and direct threat to his wife,” prosecutor Debbie Feinstein told District Judge Eugene Wolfe on Wednesday, arguing that Mendoza should be held in jail without a chance to post bail. “Over the last two days, the defendant has been actively seeking someone to kill his wife for him.”

Wolfe agreed to have Mendoza held without bail. Neither the suspect nor his attorney gave their version of the case, which is typical at these early stage bond hearings. Federal immigration authorities also moved to have Mendoza held in jail, an indication that he is in the country illegally and could be deported as a result of the case.

Mendoza was tossed out of his wife’s home about six months ago after she sought a restraining order against him, court records show. In a court filing last fall, Mendoza’s wife alleged that he forced her to have sex, locked her in the bathroom and drove her to remote areas, where he threatened to kill her. A judge granted her request, ordering Mendoza to leave the home and stay away, according to court records.

Daniel Alfaro Mendoza (Montgomery County Police Department)

Last month, police say, Montgomery detectives got a tip that Mendoza was looking to pay someone $5,000 to kill his wife and her boyfriend. An undercover police officer, posing as a hit man, contacted him.

On Tuesday, the two drove to the Twinbrook Metro station, where Mendoza pointed out his wife: The woman wearing the red coat and carrying a white bag, according to arrest records.

Mendoza and the undercover officer then drove to Mendoza’s wife’s home, with Mendoza describing her walking route to the station, according to an arrest affidavit signed by Montgomery Detective Mark Janney. Mendoza told the purported hit man to take his wife’s purse and cellphone to make the killing look like a robbery, Janney wrote.

Mendoza also suggested that the assassin kill his wife’s boyfriend at night and make it look like a gang-related hit, the affidavit alleged. At first, Mendoza said he needed to sell his Honda Civic to come up with the money. Then he said he could pay $200 in advance and sign over the car title after the killings, according to the affidavit.

“Mendoza indicated he intended to return to his native country, Honduras, prior to the murders so that he would not be a suspect,” Janney wrote.

Detectives arrested Mendoza on Tuesday. They searched his car, according to charging documents, and found a handwritten note showing the boyfriend’s name next to the phrase: “Lives in Gaithersburg.”