A federal judge ordered a California man suspected of trying to aid the Islamic State group to eat dinner tonight or be force-fed.

The order from Judge David O. Carter was given Thursday to 24-year-old Muhanad Badawi, who has been refusing to eat for three weeks.

"Mr. Badawi, this is going to end today," said Carter, who pulled out his own money to pay for the meal before the marshals in charge of Badawi said they would take care of it.

Carter said at the hearing in Orange County that Badawi looks emaciated and is down to 110 pounds from a previous 140.

Badawi has not made it entirely clear why he's refusing to eat, insisting he'd not on a hunger strike and saying he wants to fast on certain days.

But Carter rejected religious claims behind the refusal to eat, saying the fasting does not coincide with any Muslim holy days.

"You've got the wrong days and the wrong time," Carter said. "This is not Friday and this is not Ramadan."

Badawi has also refused most medical treatment if it comes from women, which Carter also told him is a practice he has to stop.

Badawi appeared weak and lethargic in court, and his attorney Kate Corrigan said she has seen a decline in his mental state since the terror attacks in Paris last month.

Badawi is charged with improperly using federal financial aid to buy an alleged co-conspirator, Nader Elhuzayel, a plane ticket to Turkey. He has pleaded not guilty to charges of conspiring to provide support to a foreign terrorist organization.