King Stephen of England was fighting in the south, but upon hearing of David's progress through Northumberland he sent a force of mostly mercenaries to meet the Scots. On 22 August 1138, the two armies met near York.
It is called the Battle of the Standard because the Archbishop of York, Thurstan of Bayeaux, created the standard that was carried in battle. Thurstan supported King Stephen over Matilda, and he gathered a fighting force from the north to join with Stephen's mercenaries. Mounting a ship's mast on a cart, Thurstan attached to it the banners of Saint Peter of York, Saint John of Beverley, and Saint Wilfrid of Ripon. The cart also carried a pyx, a container containing a consecrated Host to provide spiritual support. (In the above illustration, by John Gilbert, you see Thurstan standing on the cart with the standard, blessing the troops.)
Divine support was hardly needed, as the unarmed Scots were up against an armed (and often mounted) opponent who also had archers. The attacking Scots failed to make any progress and within three hours had descended into chaos except for small groups still protecting David and his son. The English force did not bother to pursue the retreating enemy, certain that they would go back to their borders. But David's army regrouped in Carlisle.
Thurstan negotiated a truce, which left David at Carlisle so long as he did not expand his aggression. He was allowed to retain some of the territory he had conquered. Later, however, once Henry II came to power, Henry re-took all the territory that had been granted to David from David's successor, Malcolm IV.
Was King David an enemy of England? Not really. He was quite loyal to Henry I and owed Henry for helping him achieve the throne, and even wanted to model Scotland's government after what he saw in England. I'll talk more about David I next time.