A Nebraska man who thought he was meeting a 15-year-old girl at an Iowa motel for sex has been sentenced to three years in prison.

The Des Moines Register reports a federal judge sentenced John Daniel Nielsen for travel with intent to engage in illicit sexual conduct.

The 40-year-old Omaha, Nebraska, man was swept up in a law enforcement operation targeting sex-trafficking after exchanging text messages with an undercover officer posing as the teen.

Nielsen arranged a Feb. 15 meeting at a Council Bluffs, Iowa, motel and agreed to pay for the sex. He was arrested when he arrived at the motel room.