No children were hurt in the late-morning shooting in the office at Louisiana Schnell Elementary School in Placerville, but one student may have witnessed the shooting, Police Chief George Nielson said.
Principal Sam LaCara, 50, died in the attack, Nielson said.
Authorities said they arrested janitor John Luebbers, 44, at his home about an hour after launching a manhunt. Investigators were trying to determine a motive for the shooting about 50 miles east of Sacramento.
LaCara, who died at Marshall Medical Center, was called a dedicated leader by Bob Wells, executive director of the Association of California School Administrators.
"Sam has been a role model to school leaders for his dedication to students and to public schools," Wells said. LaCara had served as a treasurer of the group.
Nielson was asked by reporters if Luebbers had been laid off. The chief said that possibility was part of the investigation, but he was uncertain about Luebbers' employment status.
"There may have been some kind of dispute between the principal and the custodian," Nielson said.
Police do not believe the janitor had a criminal history.
Nielson said LaCara's family was devastated. "They are requesting privacy at this time," he said.
Chaplain Jim Thompson met with the family at the hospital after being sent by law enforcement officers.
"They're very, very angry at the perpetrator, who they happen to know, (he) knew the principal very well," Thompson told KCRA-TV.
KCRA reported that LaCara, of Sacramento, was married and has three daughters.
California Highway Patrol Lt. Chuck King said LaCara's wife was driving on Highway 50 to the hospital after hearing about the shooting when she was pulled over by a CHP officer for speeding. Instead of being ticketed, she was escorted to the hospital.
The state's superintendent of public instruction, Tom Torlakson, thanked police and school officials for quickly securing the campus in the wake of the shooting. Classes were canceled at all district schools Thursday.
"Our schools should be safe havens from guns and violence, and I'm deeply saddened when harm comes to anyone working to educate California's children," Torlakson said.
Police also commended the school staff for quickly locking down the school and protecting the children. Students were taken to the county fairground, where they were released to their parents.
"The children were safe in this incident. The principal was the target in this, unfortunately," Nielson said.
A candlelight vigil for LaCara was planned Wednesday night outside a Placerville church.