Supporters of an independence referendum in Catalonia have begun occupying polling stations in a bid to ensure Sunday's vote goes ahead, stoking fears of violent confrontation with Spanish police.

Spain's central government in Madrid, which opposes the referendum, has sent thousands of police reinforcements to the Catalonian capital of Barcelona to stop people from voting.

A court on Wednesday ordered police to prevent the use of public buildings "for the preparation and organisation" of the referendum.

But as classes ended for the day, small groups of activists, including parents with their children, on Friday peacefully occupied several schools where voting is scheduled to take place.

READ MORE: All you need to know about the Catalonia referendum

"We want to make sure the school is open for activities and at night when they might come to clear us out or empty it, there will be families sleeping or people in the street," Hector, 43, told Reuters news agency.

The head of the Catalan regional police has ordered officers to evacuate and close polling stations by 6am on Sunday, before voting starts at 9am.

Parents vowed to come out and protect their children occupying the schools.

"I am going to sleep here with my oldest son who is a student here," Gisela Losa, a mother of three, told AFP news agency at Reina Vionant primary school in Barcelona's Gracia neighbourhood.

Spain's government said on Saturday police had sealed off 1,300 of 2,315 schools in Catalonia that had been designated as polling stations for the banned independence referendum.

A government source said 163 schools earmarked as voting centres have been occupied by families.

WATCH: Catalonia referendum - One country, two stories (25:05)

Madrid has repeatedly warned those who help stage a referendum, which the courts have ruled unconstitutional, will face legal repercussions.

Spain's education ministry said in a statement on Friday that school directors in Catalonia "were not exempt from liability" if they cooperated.

"There is nothing that justifies violating so basic a right as the right to vote," said Omar Sanchis, a 29-year-old drama student, standing behind the railings of the Collaso i Gil school, which he and others had occupied.

The Catalan government says 2,315 polling stations are ready to go.

Al Jazeera's John Hendren, reporting from Barcelona, said both sides have been preparing for confrontation over the looming vote.

"Clearly, many of the polling stations will be shut down [by Spanish authorities]," he said. "The government of Catalonia has said ... it will declare itself an independent republic if they get the votes."

Final rally

On Friday evening, about 10,000 supporters of the referendum gathered off Barcelona's Placa d'Espanya, or Spain Square.

Catalan leader Carles Puigdemont said regardless of how many people actually cast the ballots, if a majority say "yes", he will declare independence on Tuesday.

"In these hugely intense and hugely emotional moments, we sense that what we once thought was only a dream is within reach," Puigdemont told a cheering crowd.

"On Sunday, we have a date with the future."

READ MORE: Catalan leader accuses Spain of 'totalitarian' actions

Catalonia's foreign affairs chief Raul Romeva told Al Jazeera on Friday the referendum "is impossible to stop" despite the central government in Madrid insisting that the vote is illegal and it will not happen.

Opinion polls show Catalonia's roughly 7.5 million residents are divided on independence.

A survey commissioned by the regional government in July showed 49.4 percent of Catalans were against independence while 41.1 percent were in favour.

More than 70 percent of Catalans want a legal referendum on independence to settle the issue.