diff --git a/include/class.team.php b/include/class.team.php
index b3f996d28fc658ed03d5e458679fc97953de000b..48d7b5655ee2066a73811cf76bd3663476b97a0c 100644
--- a/include/class.team.php
+++ b/include/class.team.php
@@ -136,6 +136,30 @@ class Team {
         return true;
     }
 
+    function delete() {
+        global $thisstaff;
+
+        if(!$thisstaff || !($id=$this->getId()))
+            return false;
+
+        # Remove the team
+        $res = db_query(
+            'DELETE FROM '.TEAM_TABLE.' WHERE team_id='.db_input($id)
+          .' LIMIT 1');
+        if (db_affected_rows($res) != 1)
+            return false;
+
+        # Remove members of this team
+        db_query('DELETE FROM '.TEAM_MEMBER_TABLE
+               .' WHERE team_id='.db_input($id));
+
+        # Reset ticket ownership for tickets owned by this team
+        db_query('UPDATE '.TICKET_TABLE.' SET team_id=0 WHERE team_id='
+            .db_input($id));
+
+        return true;
+    }
+
     /* ----------- Static function ------------------*/
     function lookup($id){
         return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null;