By Jonathan Stempel

NEW YORK (Reuters) - New York City Marathon organizers on Friday settled a lawsuit by runners who said their use of a lottery, in which nonrefundable fees were charged, to decide who gets to race was illegal.

Papers detailing the settlement with the nonprofit New York Road Runners Inc were filed with the U.S. District Court in Manhattan. Court approval is required.

The Road Runners agreed to provide $2.1 million of credits, ranging from $1.25 to $11, on entry fees to future marathons and other races it sponsors to runners who entered drawings for the marathon or New York City Half Marathon between 2010 and 2015.

It also agreed not to charge for drawings to run in its races for three years or to apply for a state lottery license, valued at about $3.1 million, settlement papers show.

The nonprofit will also improve disclosures, donate $100,000 to the New York City Parks Foundation, and pay up to $670,000 in legal fees and costs to the plaintiffs' lawyers, the papers show.

"We have entered into a settlement agreement on matters related to our race entry drawing to the satisfaction of all the parties," Road Runners spokesman Chris Weiller said.

The nonprofit denied wrongdoing in agreeing to settle. This year's marathon is scheduled for Nov. 6.

Utah residents Charles Konopa and Matthew Clark had sued the Road Runners in January, claiming they paid the $11 fee for a chance to run the marathon but did not win, like roughly 85 percent of those who applied.

They claimed the drawing violated New York's constitution because only the state itself could run chance-based lotteries.

The 26.2-mile (42.2 km) marathon through New York City's five boroughs has been run every year since 1970, except for 2012 after Hurricane Sandy.

Nearly 99 percent of the 50,235 runners from 125 countries who started last year's race finished.

Entry fees for the race, ranging from $216 to $347, were not the subject of the lawsuit.

The case is In re: New York Road Runners Litigation, U.S. District Court, District of New York, No. 16-00450.

(Reporting by Jonathan Stempel in New York; Editing by Bernard Orr)