Authority to lay railroad tracks through the streets and public highways of any city or city and county may be obtained for a term of years not exceeding 50, from the governing body of the city or city and county, under such restrictions and limitations, and upon such terms and payment of license tax, as the governing body may provide. Permission shall not be granted to propel cars upon such tracks otherwise than by electricity or by wire ropes running under the streets and moved by stationary engines except as provided in Section 7813. The governing body in granting the right, or at any time after the right is granted, may impose such terms, restrictions, and limitations as
to the use of streets and the construction and mode of operating the road as it deems to be for the public safety or welfare.