The board of supervisors may by ordinance provide for the establishment, support, and maintenance of a delinquency prevention agency or department, or may assign delinquency prevention duties to any existing county agency, or department. Any such agency or department may engage in activities designed to prevent juvenile and adult delinquency, including rendering direct and indirect services to persons in the community, and may cooperate with any other agency of government in carrying out its purposes.