The mayor may appoint extra police officers, whenever it is necessary in the judgment of the mayor for the public safety or to preserve order, to serve for a period designated by council, not to exceed 30 days and whose compensation shall be fixed by council.