Also, if so, why did the internal combustion engine get more popular than the electric motor?
The idea of an electric car is by no means modern (at least not in the common sense of this word), as electric vehicles predate the ones using internal combustion engines by almost two decades. The first functional electric vehicle has been built by Gustave Trouve in 1878 and presented publicly on the Exposition Internationale d'Électricité, a technological exposition held in Paris in 1881. There was already some interest in electric vehicles when Gottlieb Daimler constructed his internal combustion engine in 1878 and in electric vehicles when Karl Benz and Siegfried Marcus built their cars in 1885 and 1888 respectively. The electric car built and piloted by Camille Jenatzy, Belgian engineer and famous race driver was the first manned vehicle in human history that broke the barrier of 100 km/h (reaching 105.9 km/h) in 1899.
The main problem with the electric cars that haunts the design to this day, although to much lesser extent, were the batteries. The engines were efficient, compact and durable in comparison with contemporary IC motors, but the available sources of power were far less advanced, severely limiting the range and significantly contributing to the mass of the vehicle (the battery in Trouve's trike was heavier than the rest of lightweight vehicle). This is why French even designed and tested an electric propulsion in the Char Saint-Chammond tank presented in 1916, although the two electric engines, one for each track, had to be powered by an on-board generator using 90hp IC motor. Quick advances in the internal combustion technology quickly rendered such solutions, as well as the general usage of electric engines for common transportation obsolete for almost a century.
Even though the electric engines were quite well developed and offered potentially more power and especially much higher torque while being silent and less prone to catastrophic failure, their Achilles' heel the development of batteries did not match the development of the electric engine or the rapidly progressing development of internal combustion engines. Technological constraints caused them to contain relatively low charge and to scale poorly, making it necessary for the electric vehicles to carry very large heavy battery that was able to provide very low range and required long charging. In addition, batteries were and to some extent still are much more prone to changes in environment temperature, especially cold. At the same time, internal combustion engines had fuel tank that was relatively small in comparison with the general dimensions of the vehicle while providing ability to drive continuously for hundreds of kilometres (with the ability to carry fuel making it possible to cover thousands of kilometres) and fuel could have been replenished in the matter of minutes if not seconds. With the initial construction problems resolved, internal combustion engines in vehicles were simply far more convenient than the electric ones, chiefly on account of batteries (please note that electric vehicles in which batteries are not an important issue due to the direct connection to the electric network, such as trams or trains were developed and used to good effect). In addition, batteries were too heavy to considered their usage in any flying vehicle, closing this area of development for the electric engines, while the attempts to optimize airplane and airship engines contributed to the development of internal combustion engines in general.