New York's attorney general announced a settlement Monday with the National Junior College Athletic Association to eliminate a rule nationally that limited sports eligibility mostly to students who attended at least three years of high school in the United States.

That rule violated city and state laws against discrimination based on national origin, the settlement agreement said.

"Our state remains one of the most thriving in the nation because of the millions of immigrants that, for centuries, have come here seeking opportunity through their own hard work," Attorney General Eric Schneiderman said. "New York is committed to the principle that such opportunity is best realized through an educational system open to all students, regardless of where they were born or attended high school."

Community colleges enroll almost half of all U.S. undergraduates, and about one-fourth have an immigrant background, according to the attorney general's office.

Several public junior colleges in New York brought the issue to Schneiderman's attention last year, including some denied exemptions by the association. In the fall of 2013, about 39 percent of students enrolled at junior colleges within the City University of New York system were born outside the mainland U.S., the attorney general's office said.

The concern among some open-enrollment schools, which led to the rule initially in 2012, was that competitors were fielding older foreign athletes.

The NJCAA board voted Saturday to eliminate the rule, which required 75 percent of the players on a team to have spent three years in a U.S. high school, according to the association. Its membership includes 525 public and private junior and two-year colleges across the country, including 41 in New York.

"After thorough discussion and review, the board found that these bylaws are inconsistent with the association's mission and detracts from the organization's goal of promoting healthy and fair competition," the association said.