Move Gameobject towards mouse

I have a gameobject and as the mouse moves closer to it I want the gameobject to move towards the mouse.

I want the gameobjects movement to be limited so it doesn’t move too far from it’s starting position.

What I have at the moment seems to satisfy this, but as the mouse gets closer to the object the object starts moving away from the mouse (which is the opposite to what I want happening).
Start Pos is the location that the gameobject started the scene at. Set during the Start() method call.

    var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);   
    transform.position = Vector3.MoveTowards(startPos, mousePos, maxDistance);

Is maxDistance a constant ? If not make sure it does not turn to a negative number when your mouse get close.
Also you should mutiply it by Time.deltaTime to be frame rate independent.

I had failed to mention that the game in question was a 2D game. In this case it made all of the difference as the mousePos had the value -10 on the Z axis. Setting this to 0 resolved the issue

var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);   
mousePos = new Vector3(mousePos.x, mousePos.y, 0);

transform.position = Vector3.MoveTowards(startPos, mousePos, maxDistance * Time.deltaTime);