LOS ANGELES -- More than 1,000 students and staff members at two Los Angeles universities were quarantined on campus or sent home this week in one of the most sweeping efforts yet by public health authorities to contain the spread of measles in the U.S., where cases have reached a 25-year high .

By Friday afternoon, two days after Los Angeles County ordered the precautions, about 325 of those affected had been cleared to return after proving their immunity to the disease, through either medical records or tests, health officials said.

The action at the University of University of California, Los Angeles, and California State University, Los Angeles -- which together have more than 65,000 students -- reflected the seriousness with which public health officials are taking the nation's outbreak.

"Measles actually kills people. So we have to take that really seriously," said Dr. Armand Dorian, chief medical officer at USC Verdugo Hills Hospital.

Those under the quarantine were instructed to stay at home and avoid contact with others. They also were barred from travelling by public transportation, including planes, trains, buses or taxis. If they must travel for an emergency, they were told to notify public health officials first.

"This is a legally binding order," the county's public health director, Dr. Barbara Ferrer, told reporters.

Anyone who violates it could be prosecuted, she said, but added that it appears everyone is co-operating so far. She didn't describe what penalties those who don't could face.

The number of measles cases in the U.S. has climbed to nearly 700 this year, including five in Los Angeles County and 38 altogether in California. The surge is blamed largely on parents not getting their children vaccinated because of misinformation about the supposed dangers.

Still, several students at Cal State-LA were shocked that their campus could be hit by a measles outbreak.

"When they were like measles, I was like, 'What? Where did that come from,"' said Sergio Dula, a communications major.

Eden Guerra, a kinesiology major, was surprised classes weren't cancelled, noting, "This is like serious, like it's life, you know."

Cal State-LA reported 875 students, staff, faculty and visitors were placed under quarantine after possibly being exposed to measles earlier this month. About 250 had been cleared by Friday after proving they are immune to the disease.

At UCLA, 129 students and faculty were quarantined. All but 46 had been cleared by Friday.

Cal State-LA is primarily a commuter school, while many UCLA students live on campus. Some UCLA students were provided a quarantine area to stay in, university officials said, though they gave no details. Only one person remained there Friday.

Those covered by the quarantine were singled out based on their possible exposure to either an infected UCLA student who had attended classes in two buildings on three days earlier this month, or a person with measles who visited a Cal State-LA library on April 11, officials said.

Those possibly exposed at Cal State-LA were located by tracking the records of people working in the library and those who logged on to its computers during the four hours the infected student was there.

Given the amount of time a person can remain contagious, officials said the quarantine would end at UCLA on Tuesday and at Cal State-LA on Thursday.

Around the country, lawmakers in California, New York, Washington state and Oregon have responded to the outbreak by moving to crack down on exemptions to vaccinating children. On Friday, President Donald Trump urged everyone to get vaccinated.

Most of the cases are centred in two ultra-Orthodox Jewish communities in New York -- one in Brooklyn, the other in suburban Rockland County.

In Rockland County, officials declared a state of emergency and at one point tried to bar unvaccinated children from schools and other public places, but a judge overturned the order.

Authorities ordered mandatory vaccinations earlier their month in the affected Brooklyn neighbourhoods and threatened fines of $1,000. City officials said earlier this week that 12 people had been issued summonses.

Measles usually causes fever, runny nose and an all-over rash but in a small number of cases can lead to deadly complications such as pneumonia and swelling of the brain.

The Centers for Disease Control and Prevention recommends the vaccine for everyone over a year old, except for people who had the disease as children. Those who have had measles are immune.

Health officials at a news conference repeatedly urged people who haven't been exposed to measles to get vaccinated, saying the vaccine is safe and effective.

"Ninety per cent of people who are not immunized or haven't had measles before, when they're exposed to measles are likely to get measles," Ferrer said.

------

Associated Press Writers Krysta Fauria and John Antczak contributed to this report.