"Except as otherwise provided by law, whenever required, the Sheriff shall attend (all) courts held within his county provided, however, that a Sheriff shall attend a civil action only if the presiding judge or his designee makes a determination that the attendance of the Sheriff at such action is necessary for reasons of public safety. The Sheriff shall enforce all lawful orders and directions of all courts within his county." (Govt. Code 26603)