A federal appeals court says former Sen. Larry Craig of Idaho improperly used campaign funds to pay for his legal defense after his arrest in a 2007 airport bathroom sex sting.

The ruling Friday upheld a lower court decision that said Craig must pay the federal government $242,000 for violating election laws.

Craig was arrested at the Minneapolis-St. Paul International Airport after an undercover police officer said the lawmaker tapped his foot under the bathroom stall in a signal that he wanted sex.

The senator pleaded guilty to disturbing the peace, but after news of the incident broke, he began a prolonged legal fight using campaign money to undo his plea.

Craig argued the payments were permitted under Senate rules allowing reimbursements for official travel costs.