But then they had a job which Kirk and Sula had no jurisdiction over.
They were there to guard the prisoner. Kirk and sulu were potential threats to that job.
How? Kirk and Sulu were Starfleet officers. The guards were also in Starfleet. Whatever their assignment may have been, they were still subject to the same chain of command that anyone else would be.
Kirk and Sulu aren't in their chain of command. They answer to their commanding officer, not Kirk or Sulu.