HIGHLANDS RANCH, Colo. — After a dispute last summer, Douglas County Sheriff Tony Spurlock canceled his department’s contract to have a deputy assigned to STEM School Highlands Ranch – the site of a shooting this week that left one student dead and eight wounded, 9WantsToKnow has learned.

That came after a dispute that festered for several months, beginning with complaints for what school administrators termed the assigned deputy’s “less than acceptable” performance – and continuing with assertions from Spurlock that STEM’s leaders seemed primarily interested in using the officer for “traffic direction and parking control.”

RELATED: STEM School Highlands Ranch security guard saw muzzle of weapon, fired 2 rounds, sources say

RELATED: 1 student killed, 8 others injured when classmates open fire at STEM School Highlands Ranch

Part of the dispute also centered on the cost to the school of having the officer assigned there.

“It appears we do not share a common understanding of the role our school resource officers play in educating our community’s youth and protecting our schools,” Spurlock wrote to Penelope Eucker, the school’s executive director, on June 20, 2018.

In it, he informed her that “I am electing not to renew our school resource officer contract with STEM School for this next school year.”

Spurlock made the letter and other documents public in response to an open records request from 9Wants to Know.

RELATED: 'He was going to be something beyond what anyone could comprehend:' Kendrick Castillo's boss remembers his brilliance

RELATED: 'Perfect storm': District letter documents fears of another 'Columbine' at STEM School

For the current school year, STEM administrators hired off-duty deputies to handle traffic control and entered a contract with BOSS High Level Security, which provided an armed, private security guard to the school.

That guard was credited with taking one of the suspects into custody in Tuesday’s incident – but also is the focus of an investigation into whether he fired on a responding Douglas County sheriff’s officer. Multiple law enforcement sources confirmed to 9Wants to Know that the private security guard is suspected of firing two rounds after seeing the muzzle of a gun come around a corner. Multiple officers at the scene told investigators that gun was being used by a responding sheriff’s officer.

In a statement issued after Spurlock made the documents public, Gil Rudawsky, a spokesman for the school, said that STEM began to “have challenges” with the school resource officer assigned there during the 2017-’18 academic year.

RELATED: STEM School shooting: Ways to lend support

RELATED: STEM School Highlands Ranch shooting: 9NEWS coverage of the tragedy

“The unfortunate fact is that schools with and without SROs have experienced violence,” the statement said. “With regard to the tragedy on May 7, 2019, we credit both the actions of our private security guard, the team of DCSO law enforcement officials who were on scene within two minutes, and the heroic students and staff members at STEM for minimizing the number of fatalities and casualties.”

STEM School began the ’17-’18 academic year sharing a school resource officer with Skyview Academy, located roughly 15 minutes away. The contract called for the sheriff’s office to bear one-half of the cost and for the two schools to split the other half.

Then in April 2018, the deputy who was splitting time between the schools became ill, Spurlock said.

RELATED: Investigators look into report STEM school security officer fired at sheriff's deputy

RELATED: 'He wanted to be a hero’: Parents of STEM School victim Kendrick Castillo mourn loss of son

As a result, the department provided fill-in officers when it could the rest of the school year.

Then, on May 18, 2018, school administrators accused the department of failing to honor the contract.

“We have not had the consistent, reliable presence of a SRO at STEM,” that letter read, in part.

The school asked for a refund of $6,731.50 it had paid the department.

At that point, Spurlock agreed to the refund – and notified the school he was cancelling the contract.

In a follow-up letter on July 23, 2018, Eucker, the school’s executive director, requested that they meet to discuss the issue further.

“We sincerely hope that we can work through any misunderstandings and have a SRO on campus for the 2018-2019 school year,” Eucker wrote.

RELATED: 'Don't let fear rule you': Student who charged shooter at STEM School praises fallen classmate

RELATED: STEM School shooting: Guard was 'instrumental' in taking suspect down

According to Spurlock, sheriff’s officials presented options – including utilizing less-expensive off-duty deputies for traffic and parking control – and discussed the “requirements” to provide a full-time resource officer.

In the end, according to the school’s statement, it opted to bring in a private security guard.

“That combination gave us a significant increase in protection for our staff and students,” the school’s statement said.

RELATED: Court dates rescheduled for suspects in STEM School Highlands Ranch shooting

RELATED: Hero students? Many schools embracing approach in shooting situations

Contact 9NEWS reporter Kevin Vaughan with tips about this or any story: kevin.vaughan@9news.com or 303-871-1862.

SUGGESTED VIDEOS | Investigations from 9Wants to Know